/*WAP TO SORT NUMBER */
/*WAP TO SORT NUMBER */
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10];
inti,j,n,k;
clrscr();
printf("enter
no of elements");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter
elements");
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
k=a[j];
a[j]=a[j+1];
a[j+1]=k;
}
}
}
printf("
after sorting is \n");
for(i=0;i<n;i++)
{
printf("%d",a[i]);
}
getch();
}
/***OUTPUT***
how many no5
enter a no1 2 3 7 6
no sorting is
12367
Comments
Post a Comment