InasAwad

Untitled

Jun 25th, 2021 (edited)
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. int mystery(int a, int b)
  2. {
  3.     if (b == 1) // base case
  4.     {
  5.         cout << "a1 " << a << endl;
  6.  
  7.         return a;
  8.     }
  9.     else {// recursion step
  10.         cout << "a " << a << endl;
  11.  
  12.         return a + mystery(a, b - 1);
  13.     }
  14. }
Add Comment
Please, Sign In to add comment