Fizz Buzz

Fizz buzz

A counting game for children.

Fizz buzz is a counting game for children to teach them about division. Players take turns to count incrementally, replacing any number divisible by three with the word "fizz", and any number divisible by five with the word "buzz".

Make


Write a program to show the output of the game Fizz Buzz up to a number entered by the user.

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

CComplete the subprogram called `fizz_buzz` that:

  1. Takes one parameter, `x` that is the number to count up to.
  2. For multiples of 3 and 5 it outputs, "Fizz Buzz".
  3. For multiples of 3 only it outputs, "Fizz".
  4. For multiples of 5 only it outputs, "Buzz".
  5. For any other number it outputs the number.
  6. Note that the count starts at one, increments by one and ends at the last number.

Complete the `main program` so that:

  1. The user can input the number to count up to.
  2. It calls the `fizz_buzz` subprogram.

Typical inputs and outputs from the program would be:

1

2

Fizz

4

Buzz

Fizz

7

8

Fizz

Buzz

11

Fizz

13

14

Fizz Buzz

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Run the unit tests below to check that your program has met the success criteria.

What number should the count be up to? :100

1

2

Fizz

4

Buzz

Fizz

7

8

Fizz

Buzz

11

Fizz

13

14

Fizz Buzz

16

17

Fizz

19

Buzz

Fizz

22

23

Fizz

Buzz

26

Fizz

28

29

Fizz Buzz

31

32

Fizz

34

Buzz

Fizz

37

38

Fizz

Buzz

41

Fizz

43

44

Fizz Buzz

46

47

Fizz

49

Buzz

Fizz

52

53

Fizz

Buzz

56

Fizz

58

59

Fizz Buzz

61

62

Fizz

64

Buzz

Fizz

67

68

Fizz

Buzz

71

Fizz

73

74

Fizz Buzz

76

77

Fizz

79

Buzz

Fizz

82

83

Fizz

Buzz

86

Fizz

88

89

Fizz Buzz

91

92

Fizz

94

Buzz

Fizz

97

98

Fizz

Buzz

Check that you have:

  • Used comments within the code to describe the purpose of subprograms, conditions and iterations.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.

Registered in England and Wales: 10442992

VAT Number: 290 9845 58

Telephone: 01452 947500

Email: admin@craigndave.co.uk

Craig'n'Dave logo

Craig 'n' Dave

Bett Awards 2024 Finalist