What is the output of this program?
function()
{
y = 4;
x = 10;
z = 5;
for(y < x)
{
x = x - 3;
y = y - 1;
z = Z + x + y;
}
return z;
}
What is the output of this function ?
Answers
Answered by
4
Explanation:
so here x=10 , y=4,z=5
so we came in the for loop here the condition is y<x that is 4<10 yes 4 is less than 10
condition is true then we comw in the loop
so statement excuted so x=x-3
x=10-3=7 x=7 is assign in x beacuse of assignment operator =
then y=y-1 that is y=4-1=3
than
z=5+7+3
z=15
so end of the loop return z so answer is 15
Answered by
4
my answer is 23. IT was helpful to you
Similar questions