var z 0 var i 0 do z z i i i 1 while I SolutionAns a
Solution
Ans) a ( z=10 )
Explanation:
the intial value of z is 0
and the initial value of i is 0
in the first iteration
z=z+i ; which is z=0+0=0 .Therefore z=0
i=i+1; here i=0+1=1 therefore i=1
Now condition check will be performed (while(i<5);) means here 1<5 is true again the loop continues to iterate.
In the second itertion z=z+i; which is z=0+1=1
i=i+1; which is i=1+1=2
Now condition check will be performed (while(i<5);) means here 2<5 is true again the loop continues to iterate.
In the third iteration
z=z+i=1+2=3 therefore z=3
i=i+1=2+1=3
Now condition check will be performed (while(i<5);) means here 3<5 is true again the loop continues to iterate.
In the fourth iteration z=6
and i=4
Now condition check will be performed (while(i<5);) means here 4<5 is true again the loop continues to iterate.
in the fifth iteration z=10 and
i=5
Now condition check will be performed (while(i<5);) means here 5<5 is false .So loop terminates.
So the final answer is Z=10.
_____________________Thank You.

