s
| What will be the output of the following code: |
|
A) 10
B) 15
C) Error
D) No Output
Correct Answer: A
Solution :
[a] 10| n | i | i<=n | ans+=i | return ans |
| 5 | 1 | True | 0+1 = 1 | |
| 2 | True | 1+2= 3 | ||
| 3 | True | 3+3= 6 | ||
| 4 | True | 6+4=10 | ||
| False | .. | 10 |
You need to login to perform this action.
You will be redirected in
3 sec