62.7k views
5 votes
Write the output of the following program:

CLS

a=20

FOR x = 1 to a

IF x MOD 2 < > 0 THEN

S S+x

END IF

NEXT X

PRINT S

END​

User Palden
by
3.7k points

1 Answer

2 votes

Answer:

Expression A

Step-by-step explanation:

In this Pseudocode, the output would be 100. This is because the code is looping from 1 to 20 and adding together all of the odd numbers between 1 and 20. Since it is checking to make sure that the remainder of each number is not equal to 0 which would indicate an odd number, and if it is odd then it adds it to the variable S. Therefore, the odd numbers between 1 and 20 are the following...

1 + 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 = 100

User Jawher
by
3.3k points