Computer Science, asked by kalpnachadar1983, 3 months ago

What will be the output of the following program?
CLS
X= 20
WHILE X <30
PRINT X
X=X+1
WEND
END​

Answers

Answered by dreamrob
0

Given:

CLS

X = 20

WHILE X < 30

   PRINT X

   X = X + 1

WEND

END

Output:

20

21

22

23

24

25

26

27

28

29

Explanation:

X     X < 30     PRINT X         X = X + 1      

20    true            20           X = 20 + 1 = 21

21     true            21            X = 21 + 1 = 22

22    true            22           X = 22 + 1 = 23

23    true            23           X = 23 + 1 = 24

24    true            24           X = 24 + 1 = 25

25    true            25           X = 25 + 1 = 26

26    true            26           X = 26 + 1 = 27

27    true            27           X = 27 + 1 = 28

28    true            28           X = 28 + 1 = 29

29    true            29           X = 29 + 1 = 30

30    false

Similar questions