[ create a new paste ] login | about

Link: http://codepad.org/NydTecLD    [ raw code | output | fork ]

C++, pasted on Aug 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<iostream.h>
int  main()
{
    int a[10] = {0,3,2,8,6,9,7,1,4,5};
    for(int i=0; i<10; i++) 
    {
        for(int j=i+1; j<10; j++)
        {
            if(a[i]>a[j])
            {   
                int temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }   
        }
    }
    cout<< a << endl;
    return 0;
}


Output:
1
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]


Create a new paste based on this one


Comments: