#include<stdio.h>
#include<conio.h>
void main()
{int i,j,a[5],temp;
clrscr();
printf("enter elements :\n");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=4;i++)
{for(j=0;j<=4-i-1;j++)
{if(a[j]>a[j+1])
{temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("\n\n After sorting \n");
for(i=0;i<5;i++)
{printf(" %d",a[i]);
}
getch();
}
Comments
Post a Comment