当前位置:   article > 正文

sum of columns_input a 4*3 table, calculate the sum of each row.

input a 4*3 table, calculate the sum of each row. inut: 12 integers in 4*3 t

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:

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

output sample:

37 39 35 

代码长度限制

16 KB

时间限制

400 ms

内存限制

64 MB

C程序如下:

  1. #include <stdio.h>
  2. int main(void)
  3. {
  4. int A[4][3];
  5. for(int i = 0; i < 4; i++)
  6. for(int j = 0; j < 3; j++)
  7. {
  8. scanf("%d", &A[i][j]);
  9. }
  10. for(int i = 0; i < 3; i++)
  11. {
  12. printf("%d ", A[0][i] + A[1][i] + A[2][i] + A[3][i]);
  13. }
  14. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/71491
推荐阅读
相关标签
  

闽ICP备14008679号