Question 7

AQA Computer Science November 2021 Paper 1 (7517/1)A level13 marks

On the specification

7.1
3.1 Fundamentals of programming3.4 Theory of computation
7.2
3.3 Systematic approach to problem solving
Question text

7 A Harshad number is a positive integer which is exactly divisible by the sum of its digits. The first twelve Harshad numbers are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12 and 18 • 36 is a Harshad number. The digits of 36 are 3 and 6; the sum of these digits is 9 as 3 + 6 = 9 and 36 is exactly divisible by 9 (36 ÷ 9 = 4) • 300 is a Harshad number. The digits of 300 are 3, 0 and 0; the sum of these digits is 3 as 3 + 0 + 0 = 3 and 300 is exactly divisible by 3 (300 ÷ 3 = 100) • 15 is not a Harshad number. The digits of 15 are 1 and 5; the sum of these digits is 6 as 1 + 5 = 6 and 15 is not exactly divisible by 6 Write a program that asks the user to enter a number, n, and will then calculate and display the nth Harshad number. Example If the user enters the number 12 then the program should calculate and display the twelfth Harshad number. The twelfth Harshad number is 18 You may assume that the number that the user enters will be a positive integer. Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 7.1 Your PROGRAM SOURCE CODE. [12 marks] 7.2 SCREEN CAPTURE(S) showing the result of testing the program by entering the number 600 [1 mark] You are advised to spend no more than 15 minutes on this section. Type your answers to Section C into your Electronic Answer Document. You must save this document at regular intervals. These questions refer to the Preliminary Material and the Skeleton Program, but do not require any additional programming. Refer either to the Preliminary Material issued with this question paper or your electronic copy.