7 8 9
4 5 6
1 2 3
9 8 7
The input description
In line 12 digits in order of priority, in turn, input matrix, each row enter an integer,
Output description
In the form of a square matrix output the whole matrix of the data, format control for: printf (" % 4 d ", a [I] [j]);
CodePudding user response:
#includeInt main ()
{
Int a [5] [4]={0};
int i,j;
for(i=0; i<4. I++)
{
for(j=0; j<3; J++)
The scanf (" % d ", & amp; A [I] [j]);
}
for(i=0; i<4. I++)
{
for(j=0; j<3; J++)
{
If (i<4 & amp; & j<3)
{
A [I] [3]=[I] a [3] + [I] a [j];
}
A [4] [I]=[4] a [I] + [j] a [I];
}
}
for(i=0; i<5; I++)
{
for(j=0; j<4. J++)
Printf (" % 4 d ", a [I] [j]);
printf("\n");
}
return 0;
}
My answer
CodePudding user response:
... That calculate the accumulative j<3 to j<4There is a little small mistakes
CodePudding user response:
#include
Int main ()
{
Int a [5] [4]={0};
int i,j;
for(i=0; i<4. I++)
{
for(j=0; j<3; J++)
The scanf (" % d ", & amp; A [I] [j]);
}
for(i=0; i<4. I++)
{
for(j=0; j<4. J++)
{
If (i<4 & amp; & j<3)
{
A [I] [3]=[I] a [3] + [I] a [j];
}
A [4] [I]=[4] a [I] + [j] a [I];
}
}
for(i=0; i<5; I++)
{
for(j=0; j<4. J++)
Printf (" % 4 d ", a [I] [j]);
printf("\n");
}
return 0;
}
CodePudding user response:
Thank you - thank you very much!