sum of columns

Input a 4*3 table, calculate the sum of each column.

Inut:

12 integers in 4*3 tabel

Output:

3 integers separated by space

Input sample:

12 4 6
8 23 3
15 7 9
2 5 17

output sample:

37 39 35 

代码长度限制

16 KB

时间限制

400 ms

内存限制

64 MB

C程序如下:

#include 

int main(void)
{
    int A[4][3];
    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 3; j++)
        {
            scanf("%d", &A[i][j]);
        }
    for(int i = 0; i < 3; i++)
    {
        printf("%d ", A[0][i] + A[1][i] + A[2][i] + A[3][i]);
    }
}

你可能感兴趣的:(算法,数据结构,c语言)