Saturday, May 22, 2010

What would the final values of variables a, b, and c be after these program runs?

What would the final values of variables a, b, and c be after these program runs?


start


a = 2


b = 4


c = 10


while c %26gt; 6


perform changeBandC ( )


endwhile


if a = 2 then


perform changeAandB ( )


endif


if c = 10 then


perform changeAandB ( )


else


perform changeBandC ( )


endif


print a, b, c


stop





changeBandC ( )


b = b + 1


c = c – 1


return





changeAandB ( )


a = a + 1


b = b – 1


return

What would the final values of variables a, b, and c be after these program runs?
Hi!





a=3, b=5, c=8.





Good luck!
Reply:a=3, b=8, c=5
Reply:a=2,3%26lt;-- last answer is final


b=4,5,6,7,8,7,8%26lt;-- last answer is final


c=10,9,8,7,6,5%26lt;--last answer is final


No comments:

Post a Comment