Advertisement
Guest User

Md. Masud Rana2

a guest
Mar 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. //Md. Masud Rana
  2.  
  3. #include<stdio.h>
  4.  
  5. int main()
  6. {
  7.     int i, j, rows, columns, a[10][10], Sum=0,find_col;
  8.  
  9.     printf("\nEnter Number of rows:  ");
  10.     scanf("%d",&i);
  11.     printf("\nEnter Number of columns:  ");
  12.     scanf("%d",&j);
  13.  
  14.     printf("\nEnter Elements:\n");
  15.     for(rows = 0; rows < i; rows++)
  16.     {
  17.         for(columns = 0; columns < j; columns++)
  18.         {
  19.             scanf("%d", &a[rows][columns]);
  20.         }
  21.     }
  22.      
  23.     printf("Enter which column to find sum of:");
  24.     scanf("%d",&find_col);
  25.  
  26.     for(rows = 0; rows < i; rows++)
  27.     {
  28.        
  29.             Sum = Sum + a[rows][find_col-1];
  30.        
  31.        
  32.     }  
  33.     printf("\nSum of columns %d:%d\n",find_col,Sum );
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement