#include <stdio.h>
int suma(int *T, int line){
int sum = 0;
for (int j = 0; j < 4; j++) {
sum += T[j];
}
return sum;
}
int main() {
int T[4][4] = {{4, 5, 1, 7 },
{1, 8, -2, 2 },
{8, 5, 12, -7},
{6, 4, -3, 6 }};
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
printf("%d\t", T[i][j]);
}
printf("\n");
}
for (int i = 0; i < 4; i++) {
printf("\nРядок - %d сума - %d",i, suma(&T[i],i));
}
}
#include <stdio.h>
int suma(int T[4][4], int i){
int sum = 0;
for (int j = 0; j < 4; j++) {
sum += T[j][i];
}
return sum;
}
int main() {
int T[4][4] = {{4, 5, 1, 7 },
{1, 8, -2, 2 },
{8, 5, 12, -7},
{6, 4, -3, 6 }};
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
printf("%d\t", T[i][j]);
}
printf("\n");
}
for (int i = 0; i < 4; i++) {
printf("\nСтолбец - %d сума - %d", i, suma(T, i));
}
}