#include<iostream.h>
#include<conio.h>
void
main()
{
clrscr();
int
a[100],i,j,limit,temp;
cout<<"ENTER
THE LIMIT:";
cin>>limit;
cout<<"ENTER"<<limit<<
"NUMBERS:";
for(i=0;i<limit;i++)
{
cin>>a[i];
}
for(i=0;i<limit-1;i++)
{
for(j=i+1;j<limit;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
cout<<"ARRAY
AFTER SORTING:";
for(i=0;i<limit;i++)
{
cout<<"\t"<<a[i];
}
getch();
}
No comments:
Post a Comment