What will be the output of the following code
I=10,S=1
while(I >= 5) {
S=S+ I
I =I- 2
}
document. Write (S)
Answers
Answered by
7
while loop iterate 3 type
step1:s=1+10=11,i=8
step2:s=11+8=19,i=6
step3:s=19+6=25,i=4
i value lessthan 5 it's false
25
Answered by
4
Answer:
25
Explanation:
I = 10, S = 1
S = S + I
=1+ 10 (S = 1)
=11
I = I - 2
= 10 - 2 (I = 10)
= 8
11 + 8 = 19
I >= 5
i.e. 6
19 + 6 = 25
Similar questions