+ 1

how this works

https://code.sololearn.com/chkIxw38iChc/?ref=app ok i have understood most of it but how will it stop after numb will reach 1 and one more thing is i have not defined what to return then how this is returning sum. i m a bit new c++ EDIT : ok i understood why it stops at 1 but at that time the value of sum is changed 1 isn't it then how it is returning factorial. plz correct me if i m wrong.

22nd Jul 2017, 3:47 PM
shobhit
shobhit - avatar
3 ответов
+ 2
check line no 12 and 13 you will understand. edit : ' if ' statement terminates the function, once the value of 'numb' becomes 1
22nd Jul 2017, 3:57 PM
‎ ‏‏‎Anonymous Guy
+ 1
cpp returns the last variable of a function if there-s no return used.
22nd Jul 2017, 3:49 PM
Jonas Schröter
Jonas Schröter - avatar
0
if sum is variable then after numb decrements to 1 sum is also changed to 1 then how it is returning factorial and not 1.
22nd Jul 2017, 4:07 PM
shobhit
shobhit - avatar