Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Choose C. Who can explain?
Choose C. Who can explain?
First of all, you dialed the wrong place. The last Printf("\n ") should be" \n "instead of" in ".

Look at your code first:

# contains "stdio.h"

void main(){

int a[6][6],I,j;

for(I = 1; I<6; i++){

for(j = 1; j & lt6; j++){

a[I][j]=(I/j)*(j/I);

}

}

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

{

for(j = 1; j & lt6; j++){

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

}

printf(" \ n ");

}

System ("suspended");

}

This is the result of the operation, you really choose C.

Next analysis, the core code is only this piece:

for(I = 1; I<6; i++){

for(j = 1; j & lt6; j++){

a[I][j]=(I/j)*(j/I);

}

}

/*

When I =1:(1) j =1a [1] =1.

(2)j = 2a[ 1][2]= 0; Note: I and J are both i< types, so when I

There is no need to analyze i<: as long as I

Look at me>J (j/i) is also zero. So a[i][j] is also equal to zero.

When I = J, A[i][j] is equal to 1.

In fact, the logic is quite simple, mainly because I and J are both int types, and this A [I] [J] = (I/J) * (J/I); The equation has both i/j and J/I.

So whatever I do,

*/

Output also starts from a[ 1][ 1], so a [1] [1] =1; a[2][2]= 1; a[3][3]= 1; a[4][4]= 1; a[5][5]= 1;

It is the result of the above picture.