Difference between revisions of "2020 New Spec"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "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....")
 
(Task 1)
 
(One intermediate revision by the same user not shown)
Line 21: Line 21:
  
 
What you need to do:
 
What you need to do:
Task 1
+
==Task 1==
Write a program to implement the algorithm in Figure 2.
+
Write a program to implement the algorithm in '''Figure 2'''.
Task 2
+
 
 +
==Task 2==
 
Test that your program works:
 
Test that your program works:
run your program, then enter the number 720
+
* run your program, then enter the number 720
run your program, then enter the number 600
+
* run your program, then enter the number 600

Latest revision as of 11:17, 20 November 2020

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.

Figure 2

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:

Task 1

Write a program to implement the algorithm in Figure 2.

Task 2

Test that your program works:

  • run your program, then enter the number 720
  • run your program, then enter the number 600