Advertisement
apl-mhd

functionlab

Oct 4th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int rowSum(int array[4][4],int rowNumber){
  5.  
  6.     int j, sum = 0;
  7.  
  8.  
  9.         for(j =0; j<4; j++ ){
  10.                // scanf("%d", &number[rowNumber][i]);
  11.  
  12.          sum += array[rowNumber][j];
  13.         }
  14.  
  15.  
  16.  
  17. return sum;
  18. }
  19.  
  20. int main()
  21. {
  22.     int rowNo;
  23.  
  24.   int number[4][4];
  25.   int i, j;
  26.  
  27.     for(i =0; i<4; i++){
  28.         for(j =0; j<4; j++ ){
  29.                 scanf("%d", &number[i][j]);
  30.  
  31.  
  32.         }
  33.     }
  34.  
  35.     printf("Enter row NO\n");
  36.     scanf("%d", &rowNo);
  37.     printf("row sum = %d\n",rowSum(number,rowNo));
  38.  
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement