18 20 17 40 22 27 30 the output should be like this:
17 20 18 40 22 27 30
17 18 20 40 22 27 30
17 18 20 22 40 27 30
17 18 20 22 27 40 30
17 18 20 22 27 30 40
here's my code::
#include<stdio.h>
#include<conio.h>
main()
{
int num[7];
int t,a,j;
clrscr();
{printf("Enter 7 number:\n\n");}
for (a=0;a<=6;a++)
{scanf("%d",&num[a]); }
for(a=0;a<=6;a++)
{ for(j=a+1;j<=6;j++)
if(num[a]>num[j])
{ t=num[a];
num[a]=num[j];
num[j]=t; }
}
for(a=0;a<=6;a++)
{ printf("%d ", num[a]); }
getch();
}

New Topic/Question
Reply




MultiQuote


|