0

Help me to find mistakes

Hi! I've recently started learning C++ and now I have problems with recursion. The results of two functions have to match, but they don't. The first one is iteration, the second is recursion. I can't get what's wrong. Please, help me with it. https://code.sololearn.com/ciGQVmj3f5aO/?ref=app

11th Nov 2018, 4:15 PM
NatKh
2 Respuestas
+ 2
The return statement in the 'iter' function should be outside the for loop.
11th Nov 2018, 4:23 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
Ulisses Cruz, thank you, I didn't know that. But the results, if I enter, for example, 2, still don't match.
11th Nov 2018, 4:32 PM
NatKh