Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Md. Masud Rana
- #include<stdio.h>
- int main()
- {
- int i, j, rows, columns, a[10][10], Sum=0,find_col;
- printf("\nEnter Number of rows: ");
- scanf("%d",&i);
- printf("\nEnter Number of columns: ");
- scanf("%d",&j);
- printf("\nEnter Elements:\n");
- for(rows = 0; rows < i; rows++)
- {
- for(columns = 0; columns < j; columns++)
- {
- scanf("%d", &a[rows][columns]);
- }
- }
- printf("Enter which column to find sum of:");
- scanf("%d",&find_col);
- for(rows = 0; rows < i; rows++)
- {
- Sum = Sum + a[rows][find_col-1];
- }
- printf("\nSum of columns %d:%d\n",find_col,Sum );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement