Algorithm: FizzBuzz
Given a number n, for each integer i, in the range of 1 to n inclusive, print one value per line as follows:
- If i is a multiple of both 3 and 5, print FizzBuzz
- If i is a multiple of 3 (but not 5), print Fizz
- If i is a multiple of 5 (but not 3), print Buzz
- If i is not a multiple of 3 or 5, print the value of i
Video
Suscríbete al canal
Try the code in CodePen
See the Pen Algorithm FizzBuzz by Vladimir Salguero (@vladisalguero) on CodePen.