This test is run by .
Note that your final mark will not be saved in the system.
Note that your final mark will not be saved in the system.
Algorithms (2.1) Typeit
Target Level
4-5
Running Total
0
0%
Attempt
1 of 3
Type the correct answers into the spaces. Fill all the spaces before clicking ‘Check Answers!’
This algorithm gets two numbers from the user, and displays every multiple of 5 between the two numbers (including the two given numbers):
x = input("Enter the lower bound") //Gets the first number from the user
y = input("Enter the upper bound") //Gets the second number from the user
while y = x //Loops through every number from x to y
if x 5 == 0 then //Checks whether or not the number is a multiple of 5
print() //Displays the number
x = x +
This algorithm removes the last digit of a number until the number is odd or less than 10. For example 2024 goes to 202, then to 20, then to 2 which is less than 10. Similarly 1146 goes to 114, then to 11 which is odd.
x = input("Enter a number") //Gets a number from the user
while x MOD 2 0 AND x > //Checks if the number is odd or less than 10
x = (x - (x MOD 10)) 10 //Removes the last digit of the number
print(x) //Outputs the result