+ 2
Can someone explain me this code bit ,how the output is 95?
https://code.sololearn.com/c1V6JM945h4n/?ref=app Thanks in advance:))
8 Answers
+ 2
Let's start executing the code
x=60
So if statement will run
X=cbsc(70)
Now it will run for 70
X=cbsc(80)
For 80
X=cbsc(90)
For 90
X=cbsc(100)
Now for 100 it return 99
X=cbsc(90) =99
Now it return 98
X=cbsc(80) =97
Doing same
X=cbsc(70) =96
X=cbsc(60) =95
+ 3
This is how ans is 95
// cbsc(70)-1
// cbsc(80)-1-1
// cbsc(90)-1-1-1
// cbsc(100)-1-1-1-1
// 100-1-1-1-1-1
//95
+ 2
Yeah in recursion if you call a function then it stops the execution of current function and start executing the function which is called after completing that it will continue the execution of current function where it leaves
+ 1
Thanks YUGRAJ a load for your patience it's so crystal clear!!
+ 1
Yeah absolutely right
0
Thank you SAYEDđ§đ©đ”đž
0
not getting, why is it going to the state return , if it is not called until the condition is met?
I mean return will be called after completing entire recursion right?idk but I'm breaking here to understand...
0
Okay,so it does return for all the functions!! understood finally:))
60 70 80 90 100
-1 for each so 100-5=95