| chapter | 21 |
|---|---|
| pageNumber | 155 |
The FizzBuzz problem is one of the commonly asked questions, here one has to print Fizz and Buzz upon some conditions.
- Write a program to print all the numbers between 1 to 100 in such a way that the following conditions are met.
-
For multiples of 3, instead of the number, print
Fizz. -
For multiples of 5, print
Buzz. -
For numbers that are multiples of both 3 and 5, print
FizzBuzz./ 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 .... .... 98 Fizz Buzz /
-
- Visit the loops chapter to understand how the loop works.
{% if output.name == "website" %} {% aceeditor compilerTitle="Try it!" %} {% endaceeditor %} {% endif %}