Challenges 5
Challenges 5
5a). Get the computer to produce a simple times table loop of a number.
Low: Show the 7 times table.
Med: Get them to enter a number then show the times table as below (up to 10):
Enter a number:6
1 x 6 = 6
2 x 6 = 12
3 x 6 = 18
High: Get them to enter the start and end number of the times table:
Enter a number:6
Enter start:5
Enter End:8
5 x 6 = 30
6 x 6 = 36
7 x 6 = 42
8 x 6 = 48
5b). Get the user to enter a number and do the following:
High:
Print out all the factors of a number.
You will need to use the Mod function to see if a number is a multiple of a number.
Example:
6 % 2 = 0
% (Mod) gives the remainder of that division so here 6 divides by 2 is 3 remainder 0 so because we have nothing left over we know that 2 multiplies into 6 (a factor).
Super High: If the number is a prime number then after the loop say so.
So you need to count how many factors there are and if there are only 2 then the number is prime.