int main()
{
int i,j,num,list[6],temp;
printf("Enter the Numbers:");
for(i=0;i<6;i++)
{
scanf("%d",&list[i]);
}
printf("Entered Numbers are:");
for(i=0;i<6;i++)
{
printf("%d ",list[i]);
}
for(i=0;i<6;i++)
{
for(j=0;j<5;j++)
{
if(list[j]>list[i])//if u put > as < u will get descending order
{
temp=list[i];
list[i]=list[j];
list[j]=temp;
}
}
}
printf("\nascending order\n");
for(j=0;j<6;j++)
{
printf("%d ",list[j]);
}
printf("\n");
}
No comments:
Post a Comment