Advertisement
avr39-ripe

rewFwRecursion

Mar 10th, 2020
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. void action(int n)
  2. {
  3.     std::cout << n << '\n';
  4. }
  5.  
  6. void revLoopRecursion(int n)
  7. {
  8.     std::cout << "In" << '\n';
  9.     if (n - 1 == 0)
  10.     {
  11.         action(0);
  12.     }
  13.     else
  14.     {
  15.         action(n - 1);
  16.         revLoopRecursion(n - 1);
  17.     }
  18.     std::cout << "Out" << '\n';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement