#include<stdio.h> int main() { int arr[3][3]; int i,j,sr,sc; printf("Enter Matrix:\n"); for(i=0;i<3;i++){ for(j=0;j<3;j++){ scanf("%d",&arr[i][j]); } } printf("Matrix is:\n"); for(i=0;i<3;i++){ for(j=0;j<3;j++){ printf("%d\t",arr[i][j]); } printf("\n"); } for(i=0;i<3;i++){ sr = 0; sc = 0; for(j=0;j<3;j++){ sr = sr + arr[i][j]; sc = sc + arr[j][i]; } printf("The Sum of Row is:-----%d\n",sr); printf("The Sum of Coloumn is:-%d\n",sc); } return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter