Difference between revisions of "2020 A Level"
(Created page with "Write a program that asks the user how many numeric digits they would like to enter and then gets the user to enter that number of numeric digits. The program should calculat...") |
|||
Line 4: | Line 4: | ||
Example | Example | ||
− | If the user says they are going to enter four digits and then enters the | + | If the user says they are going to enter four digits and then enters the digits 3, 4, 5 and 3, the program should display the value 2 as the |
− | digits 3, 4, 5 and 3, the program should display the value 2 as the most | + | most frequently entered digit was 3 and that digit was entered twice. |
− | frequently entered digit was 3 and that digit was entered twice. | ||
If more than one numeric digit had the same frequency and was the most frequently entered then instead of displaying the frequency, a message saying "Data was multimodal" should be displayed. | If more than one numeric digit had the same frequency and was the most frequently entered then instead of displaying the frequency, a message saying "Data was multimodal" should be displayed. |
Revision as of 10:25, 20 November 2020
Write a program that asks the user how many numeric digits they would like to enter and then gets the user to enter that number of numeric digits.
The program should calculate and display the number of times the most frequently entered numeric digit was input.
Example If the user says they are going to enter four digits and then enters the digits 3, 4, 5 and 3, the program should display the value 2 as the most frequently entered digit was 3 and that digit was entered twice.
If more than one numeric digit had the same frequency and was the most frequently entered then instead of displaying the frequency, a message saying "Data was multimodal" should be displayed.
A numeric digit is 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9
You may assume that the number that the user enters to state how many numeric digits there will be and the numeric digits entered by the user are all valid.
What you need to produce
Your PROGRAM SOURCE CODE.
A SCREEN CAPTURE(S) showing the result of testing the program by entering:
- the number 6 then the numeric digits 0, 1, 2, 1, 2 and 1
- the number 5 then the numeric digits 0, 1, 2, 2 and 1