From the famous FizzBuzz challenge,
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".
In this challenge, you don't need to print anything, instead, your program should count on variables, the number of Fizz found, the number of Buzz, the number of FizzBuzz and the number of the rest (non multiples of 3 and 5).
And then, print the numbers found, like this:
From 1 to 100 Fizz: 30 Buzz: 17 Others: 53 FizzBuzz: 6 (this don't count, they were already incremented on Fizz and Buzz)
Hey, hold there...
What do you mean with
this don't count, they were already incremented on ping and pong?
Yes, you should increment all multiple of 3 on the
Fizz counter, all multiples of 5 on the
Buzz counter, and also all multiples of 3 and 5 on the
It means that if you sum
Fizz + Buzz + Others it will be equal to
FizzBuzz counter is just to know how many multiples of 3 and 5 we have.
- This is a code-gold, in one week, the shortest wins.
- Any programming language will be accepted.