sorting numbers

/*geting ten numbers from user and sort it*/

#include
#include
void main()
{
clrscr();
cout<<"how many number";
int a[10],n;
cin>>n;
cout<<"enter element";
for (int i=0;i cin>>a[i];
for(i=0;i {
for(int j=i+1;j {
if(a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
cout<<"sorting is \n==> ";
for (i=0;i {
cout< " ;
}
getch();
}

0 comments:

Post a Comment