Header Ads Widget

Responsive Advertisement

Trace table on while loop by data input Part - 3

 





1.While M1 <> -1

2.Input M1

3.Input M2

4.M3 = M1 + M2

5.Print M3

6.Wend

Make a trace table for this program using 6&4, 5&7, -1&-1:

Line

M1

M1 <> -1

M2

M3

Output

1

0

Yes

 

 

 

2

6

 

 

 

 

3

 

 

4

 

 

4

 

 

 

10

 

5

 

 

 

 

10

1

6

Yes

 

 

 

2

5

 

 

 

 

3

 

 

7

 

 

4

 

 

 

12

 

5

 

 

 

 

12

1

5

Yes

 

 

 

2

-1

 

 

 

 

3

 

 

-1

 

 

4

 

 

 

-2

 

5

 

 

 

 

-2

1

-1

No

 

 

 

 

 

 

STOP 

 

 




Post a Comment

0 Comments