Computer Science · May / June 2018 · Paper 22 · Question 3
2210
As printed in the paper
The question as text
This pseudocode algorithm inputs two non-zero numbers and a sign, and then performs the calculation shown by the sign. An input of zero for the first number terminates the process. INPUT Number1, Number2, Sign WHILE Number1 <> 0 IF Sign = '+' THEN Answer Number1 + Number2 ENDIF IF Sign = '-' THEN Answer Number1 - Number2 ENDIF IF Sign = '*' THEN Answer Number1 * Number2 ENDIF IF Sign = '/' THEN Answer Number1 / Number2 ENDIF IF Sign <> '/' AND Sign <> '*' AND Sign <> '-' AND Sign <> '+' THEN Answer 0 ENDIF IF Answer <> 0 THEN OUTPUT Answer ENDIF INPUT Number1, Number2, Sign ENDWHILE
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
3(a)[3]
3(b)[3]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

