10 find the output of the following programs
segments
i=0; sum =0
while i < 9:
if i % 4 ==0
sum =sum +i
i=1+2
print (sum)
Answers
Answered by
1
Answer:
The output is 12
Explanation:
The ‘while’ loop will run till the value of 'i' is 8, and the condition in ‘if’ function will return true for two values i.e. 4 and 8, which will be added to ‘sum’. The last statement will print the value of the variable ‘sum’.
Similar questions