202k views
2 votes
What is the output of code corresponding to the following pseudocode?

Declare A As Integer

Declare B As Float

Set A = 2

While <= 3

Set B = 2.5 * A

Write B

Set B = Int(B)

Write B

Set A = A + 1

End While

Answer
A.
5,7
B.
5,5,7.5,7
C.
5,5,7,7
D.
2,5,3,7

1 Answer

4 votes

Answer:

B

Step-by-step explanation:

The while statement has a typo. It should be While A <= 3

So A goes through the values 2 and 3.

For the value A=2, the program prints 5 and 5

For the value A=3, the program prints 7.5 and 7, where 7 is the truncated version of 7.5.

User JanHak
by
8.3k points