+ 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.
3 Réponses
+ 2
check line no 12 and 13 you will understand.
edit : ' if ' statement terminates the function, once the value of 'numb' becomes 1
+ 1
cpp returns the last variable of a function if there-s no return used.
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.