Help me to find mistakes | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponses
+ 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