Print the numbers from 1 to 100 on new lines. For any number divisible by 3, print "Fizz" instead of the corresponding number. For any number divisible by 5, print "Buzz" instead of the corresponding number. For any number divisible by 3 and 5, print "FizzBuzz" instead of the corresponding number.
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
โฎ
Buzz
To the best of ability, all samples will follow this simple format where n is 100.
for i = 1 to n do
if i is divisible by 3 and i is divisible by 5 then
print "FizzBuzz"
else if i is divisible by 3 then
print "Fizz"
else if i is divisible by 5 then
print "Buzz"
else
print i
- C
- C++
- C#
- COBOL
- Fortran
- Go
- Haskell
- Java
- Javascript
- Julia
- Python
- R
- Ruby
- SQL
- Swift
- Typescript