#include <stdio.h>
int main()
{
int a[10],i,j,t;
printf("\n Enter the 10 Values :");
for(i=0;i<=9;i++)
scanf("%d", &a[i]);
for(i=0;i<=8;i++)
{
for(j=i+1;j<=9;j++)
{
if(a[i]>a[j]) // Compare an Element a[i] with all elements
{
t = a[i];//Interchanging Values
a[i]=a[j];
a[j]=t;
}
}
}
printf("\n Sorted Elements are : ");
for(i=0;i<=9;i++)
{
printf("\t%d", a[i]); //Sorted Elements
}
return 0;
}
Comments
Post a Comment