FizzBuzz
Easy
Print numbers from 1 to 100.
- For multiples of 3, print "Fizz"
- For multiples of 5, print "Buzz"
- For multiples of both, print "FizzBuzz"
- Otherwise print the number
- For multiples of 3, print "Fizz"
- For multiples of 5, print "Buzz"
- For multiples of both, print "FizzBuzz"
- Otherwise print the number
Input
None (1 to 100)
Output
Each number or Fizz/Buzz/FizzBuzz on a new line
Example
Input
N/A
Output
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz
Use the modulus operator %. Check for both (3 and 5) first!
⚡ 10 XP on solve
← Back to lesson
Your Solution
Output
Click "Run" to execute your code...
⏳ Loading Python runtime (first run may take a few seconds)...
Log in to submit your solution and earn XP.