Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
634 B
0
Indexable
Never
#include<stdio.h>
int main()
{
    int n,m,i,j,arr[100][100],sum;
    scanf("%d %d", &n,&m);
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
            scanf("%d", &arr[i][j]);
    }



    for(i=0;i<n;i++)
    {
        sum = 0;

        for(j=0;j<m;j++)
        {
            sum += arr[i][j];///arr[1][0] arr[0][1] arr[0][2]

        }
        printf("sum of row %d = %d\n", i+1,sum);


    }
    for(i=0;i<n;i++)
    {
        sum = 0;

        for(j=0;j<m;j++)  
        {
            sum += arr[j][i];/// 

        }
        printf("sum of column %d = %d\n", i+1,sum);


    }


}