CodePudding user response:
The original poster is too lazy, prompt the topic answer to almost all out,
#include
Void print (int A [4])//behind is the same output, short-cut
{
for (int i=0; I & lt; 4. I++)
{
Printf (" % d \ t ", A [I]);
}
printf("\n");
}
Int main ()
{
Int C [4], [4], AB [4], BB [4], AC [4], I, j;
Int A [4] [4]=,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 {1};
Int B [4] [4]=,4,6,8,10,12,14,16,18,20,22,24,46,28,30,32 {2};
//C=A + B
For (I=0; I & lt; 4. I++)
{
For (j=0; j <4. J++)
{
C [I] [j] A [I] [j] + B=[I] [j];
}
}
Printf (" Array C [4] [4] : \ n ");
For (I=0; I & lt; 4. I++)
{
For (j=0; j <4. J++)
{
Printf (" % d \ t, C [I] [j]);
}
printf("\n");
}
//AB
For (I=0; I & lt; 4. I++)
{
AB=[I] A [1] [I];//the second line: A [1] [0]... A [1] [3]
}
Printf (" \ nArray AB [4] : \ n ");
Print (AB);
//BB
For (I=0; I & lt; 4. I++)
{
BB [I] [I] [2]=B;//the third column: B [0] [2]... B [3] [2]
}
Printf (" \ [4] nArray BB: \ n ");
Print (BB);
//AC
For (I=0; I & lt; 4. I++)
{
AC=[I] A [I] [I] + B [I] [I];//this array, the ranks of diagonal equal index
}
Printf (" \ nArray AC [4] : \ n ");
Print (AC);
return 0;
}
CodePudding user response:
CodePudding user response: