0

i want to know what will be the sequence of values to be print out for the following algorithm using trace table

count=1
count=count + 1
while(x<2)prin
the value of x
elseprint the value of x

My answers is 0;2;2
idon't know if they are correct

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
0

There is no correct solution to the problem because:

1. The variable x is undefined and we don't know its initial value.

2. The value of x never changes, therefore that is an infinite loop

3. There is no if, so the else is incorrect.

Edited by Ancient Dragon: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.