Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In C language, 3×3 integer arrays are sorted from small to large and then output.
In C language, 3×3 integer arrays are sorted from small to large and then output.
# include & ltstdio.h & gt

void main()

{ int a[3][3],*p,*q,I,j,k;

for(I = 0; I<3; i++)for(j = 0; j & lt3; j++ ) scanf("%d ",& ampa[I][j]);

for ( i=0,p = & ampa[0][0]; I & lt3*3- 1; i++,p++)

for ( j=i+ 1,q = p+ 1; j & lt3*3; j++,q++)

if((* p)& gt; (* q)){ k =(* p); (* p)=(* q); (* q)= k; }

for(I = 0; I<3; i++,printf(" \ n "))for(j = 0; j & lt3; j++ ) printf("%d ",a[I][j]);

}