2020 New Spec
The algorithm, represented using pseudo-code in Figure 2, outputs a series of integers or the message No result. The output depends upon the value entered by the user.
OUTPUT "Enter an integer greater than 1: " INPUT X Product ← 1 Factor ← 0 WHILE Product < X Factor ← Factor + 1 Product ← Product * Factor ENDWHILE IF X = Product THEN Product ← 1 FOR N ← 1 TO Factor Product ← Product * N OUTPUT N ENDFOR ELSE OUTPUT "No result" ENDIF
What you need to do:
Write a program to implement the algorithm in Figure 2.
Test that your program works:
- run your program, then enter the number 720
- run your program, then enter the number 600