Current location - Education and Training Encyclopedia - University ranking - How to do the fourth question? I am taking a correspondence course, but I really can't.
How to do the fourth question? I am taking a correspondence course, but I really can't.
# include & ltstdio.h & gt

void main()

{

int i,j,t;

int a[20];

Printf ("Please enter 10 numbers separated by enter \ n");

for(I = 0; I< 10; i++)

scanf("%d ",& ampa[I]);

for(I = 0; I<n-1; i++)

{

for(j = 0; j & ltn-I- 1; j++)

if(a[j]& gt; a[j+ 1])

{

t = a[j];

a[j]= a[j+ 1];

a[j+ 1]= t;

}

}

Printf ("The numbers after sorting are as follows: \ n");

for(I = 0; I< 10; i++)

printf("%d ",a[I]);

}

Bubble sorting method.