Computer Science, asked by Shen20, 8 months ago

c)
i = 0; sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)

Answers

Answered by pavithranatarajan855
34

Answer:

12

Explanation:

step 1:  i=0  0<9 then 0%4==0 sum=0 now i=2

step 2:i=2  2<9 then 2%4==0 condition not satisfied so sum=0 i=4

step 3:i=4 now condition satisfied so sum=sum+4=4 i=6

step 4:i=6  6%4=2 so condition not satisfied sum=4

step 5: i=8 8%4==0 so condition satisfied sum=4+8=2 i=10

then 10<9 condition not satisfied.

so sum=12

Similar questions