Advertisement
saleemthp

Untitled

May 15th, 2020
1,345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <fstream>
  11. #include <string>
  12.  
  13. using namespace std;
  14. const int rows=3;
  15. const int cols=4;
  16. int sum(int arr[][cols],int );
  17. int main()
  18. {
  19.     int SCORES[][cols]={{90,95,70,74},{65,87,93,62},{77,88,97,88}};
  20.     sum(SCORES,2);
  21. }
  22.  
  23. int sum(int SCORES[][cols],int ROWS)
  24. {
  25.     int total=0;
  26.     for(int i=0;i<ROWS;i++)
  27.     {
  28.         for(int j=0;j<cols;j++)
  29.         {
  30.             total=total+SCORES[i][j];
  31.         }
  32.     }
  33.     cout<<total;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement