Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main()
- {
- int array[10][10];
- int i,j,m,n,sum=0;
- printf("Enter the order of the matrix: ");
- scanf("%d%d",&m,&n);
- printf("\nEnter the co-efficients of the matrix: ");
- for(i=0;i<m;+i++)
- {
- for(j=0;j<n;j++)
- {
- scanf("%d",&array[i][j]);
- }
- }
- for(i=0;i<m;i++)
- {
- for(j=0;j<n;j++)
- {
- sum+=array[i][j];
- }
- printf("Sum of the %d row is = %d\n",i+1,sum);
- sum=0;
- }
- sum=0;
- for(j=0;j<n;j++)
- {
- for(i=0;i<m;i++)
- {
- sum+=array[i][j];
- }
- printf("Sum of the %d column is = %d\n",j+1,sum);
- sum=0;
- }
- }
Add Comment
Please, Sign In to add comment