Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Enter four integers from the keyboard and store them in plastic variable A B C D, and display them in descending order.
Enter four integers from the keyboard and store them in plastic variable A B C D, and display them in descending order.
# include & ltstdio.h & gt// Because it is complicated to replace variables with abcd, arrays are used.

Int main() // wrote a bubble sort.

{ int a[5];

int i,j,t;

for(I = 1; I < = 4; i++)

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

for(I = 1; I<4; i++)

for(j = I+ 1; j & lt=4; j++)

{

if(a[I]& lt; a[j])

{ t = a[I];

a[I]= a[j];

a[j]= t;

}

}

for(I = 1; I < = 4; i++)

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

printf(" \ n ");

}