Exercise Set 3

Comprehension Questions

Programming Questions

1. FizzBuzz

From numbers 1 to 50

  • if the number is a multiple of three: print “Fizz”

  • if the number is a multiple of five: print “Buzz”,

  • if they are multiples of both: print “FizzBuzz”

  • otherwise print the number

Solution Code (Link)

2. Average Calculator

Create a program that calculates the averages of the marks that user inputs.

The user is allowed to input any amount of marks they want as long as it is 0 to 100.

Solution Code (Link)

3. Longest Name Finder

Create a program that takes an unknown amount of names and outputs the longest name.

You will know that the inputs are done when the user has inputted a string of X.

Sample Input:
Kelsey
Tyree
X

Output:
Kelsey

Solution Code (Link)

Last updated