You are not logged in. Please login at www.codechef.com to post your questions!

×

CF220 - Editorial

PROBLEM LINK:

Practice
Contest

Author: Sagar
Tester: Karan

DIFFICULTY:

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".

asked 03 Apr '16, 13:40

ishpreet's gravatar image

4★ishpreet
9718
accept rate: 0%

edited 04 Apr '16, 15:14

admin's gravatar image

0★admin ♦♦
19.8k350498541

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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