$PageTitle = "taskJ"; $PageHeading = "Open Round"; include "../files/user.php"; include "authenticate.php"; include "../header.php"; ?>
At this moment, you are not allowed access to the question.
} else { ?>Numerologists ascribe certain magical properties to numbers, and in turn derive numbers from words or phrases. Nonsense like this can still provide an interesting computational exercise.
The two algorithms of interest to us are:
Write a program that reads in up to 20 lines, preceded by the number of lines. For each line, if it contains only a number, calculate and display the digital root, spaces and the number. If it's a phrase, calculate the letter sum, then display the digital root, the sum and the phrase, agsin separated by spaces. Input and calculated numbers are less than a billion and phases are shorter than 100 characters.
Input:
5 123 the quick brown fox 7823438 "640 K ought to be enough for anybody". Bill Gates, 1981. Progcomp |
6 123 4 211 the quick brown fox 8 7823438 1 406 "640 K ought to be enough for anybody". Bill Gates, 1981. 4 103 Progcomp |
14 99999 10000 7 12345678 98765432 June UNSW Progcomp Twenty-thirteen the second figure thrice "Tragedy is when I cut my finger,... Comedy is when you walk into an open sewer and die" (attributed to Mel Brooks). the thirty-sixth triangular number, declared the number of the beast A Clockwork Orange, Stanley Kubrick: 3*114+1=343 (114 was Kubrick's signature code, it appears in four films as CRM114 or serum 114 or C-rm114.) Nineteen associates attacked the World Trade Center in New York and the Pentagon in Washington. |
5 marks for correctly implementing the digit reduction algorithm and 5 for combining it correctly with the phrase analysis.
You may submit multiple times. Only your most recent submission for each question will be marked.
} include "../footer.php"; ?>