Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int deepSumCol(int data[3][3], int n, int m){
- if (n == 1)
- return data[m][0];
- else
- return deepSumCol(data, n-1, m) + data[m][n - 1];
- }
- int deepSum(int data[3][3], int n, int m){
- if(n == 1)
- return deepSumCol(data, m, 0);
- else
- return deepSum(data, n -1, m) + deepSumCol(data, m, n - 1);
- }
- int main(){
- int a[3][3] = {
- {1, 2, 3},
- {1, 2, 3},
- {1, 2, 3}
- };
- cout << deepSum(a, 3, 3) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement