To find the sum of each row of matrix #include #include int main(){ int a[10][10],i,j; for(i=0;i<2;i++) { for(j=0;j<3;j++) { printf("enter the a[%d][%d] value:",i+1,j+1); scanf("%d",&a[i][j]); } } for(i=0;i<2;i++) { for(j=0;j<3;j++) { printf("%d\t",a[i][j]); } printf("\n"); } printf("............Sum..............\n"); for(i=0;i<2;i++) { int sum=0; for(j=0;j<3;j++) { sum= sum+ a[i][j]; } printf(" the sum of %d row is %d\n",i+1,sum); } } OUTPUT:
Post a Comment