Remainder 1
Make sure you memorize how to figure out “is x a multiple of N”? (Check to see if the remainder of x by N is 0.)
-
Ask the person for a number. Output “DIVISIBLE BY 7” if their number is divisible by 7. Otherwise output “nope”.
-
Ask the person for a number. Print “DIVISIBLE BY 23” if it is divisible by 23.
-
Ask the person for a number N. Count from 1 up to 100 printing out every number that is divisible by N.
-
Ask the person for a number and print all of the numbers from 1 up to 200 that divide that number.
-
Randomly pick a starting number in the range from 100 to 300 (inclusive), and randomly pick an end number in the range from 301 to 500 (inclusive). Ask the person for a number. Print every number from the start to the end that is a multiple of the person’s number.
N to examine? 43 scanning for mulitples of 43 from 127 to 328 129 172 215 258 301
-
A circular track has marks every meter. The track is 150 meters around. Ask the person how far they run, in meters. Print out the meter marker that they just passed.
How far did you run? 510 You just passed marker 60
-
(Caesar cipher.) Have the person type a word. Make it easy on yourself by using all uppercase. Move each letter to the right three letters in the alphabet. After Z, wrap around to A. Use
indexOf
andsubstring
to change between letters and numbers.let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Word? YELLOW BHOOQZ