×

Author: Sagar
Tester: Karan

SIMPLE

# PROBLEM:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

# EXPLANATION:

This is the easiest problem we provided just to increase the number of participants who solved atleast one problem.

Say, value of i goes from 1 to 100.

if i % 3 == 0 and i % 5 != 0: print "Fizz"
else if i % 3 != 0 and i % 5 == 0: print "Buzz"
else if i % 3 == 0 and i % 5 == 0: print "FizzBuzz"
else: print i

# TESTER'S SOLUTION:

Ideone

This question is marked "community wiki".

4★ishpreet
9718
accept rate: 0%

19.8k350498541

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,631
×1,167
×934
×14
×8
×3

question asked: 03 Apr '16, 13:40

question was seen: 504 times

last updated: 04 Apr '16, 15:14