#include<stdio.h>
void main()
{
int i,j,n,temp,a[100];
clrscr();
printf("Enter how many number do you Enter");
scanf("%d",&n);
printf("Enter number");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(j=0;j<n;j++)
{
for(i=j+1;i<n;i++)
{
if(a[j]>a[i])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
printf("Ascending order is: ");
for(i=0;i<n;i++)
printf("%d,",a[i]);
getch();
}
0 comments:
Post a Comment