CF220 - Editorial

ad-hoc
cf220
codefight
cofi1601
editorial
simple

#1

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