+ 1
What is wrong in the following code?
add of natural numbers using function https://code.sololearn.com/cU9UG4G4yoQy/?ref=app
6 Respuestas
+ 3
A few minor things.
The error messages tell it by the way. It is a good exercise to debug the code yourself ;)
However I will tell you what is wrong:
- use int instead if void for main (and return 0 at the end, that's optional though)
- missing comma , in scanf function
- return statement in natural function should come after the loop, not inside it. Otherwise it will return after the first iteration
+ 5
+ 2
for the recursive approach:
return 0
Or test for s!=1, then you can return 1
0
thks Matthias ,but I deleted
that and did using recursive function and this one is showing some bugs,can you help pls!
0
no need,ty just
0
ty:-)