please help asap
Question 8 Which of the following recursive functions can replace the below iterative function that performs the same operation? void foo(int n) ( while (n>- 1) I cout <<n<< " "; n-- 1; int main() { foo (3); O int foo (int n) ( if(n>- 1) ( int main() { foo (3); O void foo(int n) { if (n> 3) ( } cout << n << " "; foo (n - 1); } int main() ( foo (3); cout << n << " "; foo (n-1); 1 Ovoid foo(int n) ( if (n > 1) ( cout <<n<< " "; foo (n-1); foo (31;
Ovoid foo(int n) ( if (n > 1) cout << n << " "; else foo (n - 1); } int main() { foo (3); } Ovoid foo(int n) ( if (n<3) ( cout <<n<< " "; foo (n-1); 3 int main() { foo (3);
please help asap
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am