← Back

Code Challenge 12 - FizzBuzz


Introduction

FizzBuzz is a classic elementary programming challenge. The program outputs 100 statements, starting from the number one and ending with 100. However, there’s a twist. Instead of outputting the numbers 1 through 100, certain numbers are replaced with words. Numbers divisible by 3 output the word ‘fizz’ instead of the number, numbers divisible by 5 output ‘buzz’, and numbers divisible by 3 and 5 output the word ‘fizzbuzz’.

Skills to Practice

Challenge Tasks

  1. Create a console project named CodeChallenge12FizzBuzz.
  2. Begin by outputting the numbers 1 through 100 using a loop of your choice.
  3. However, if the current number is divisible by 3, instead output the word ‘Fizz’.
  4. Or, if the current number is divisible by 5, instead output the word ‘Buzz’.
  5. Finally, if the current number is divisible by 3 and 5, instead output the word ‘FizzBuzz’.

Sample Output