Iterate from 1 to 100. For increments of 3, output "Fizz". For increments of 5, output "Buzz". For increments of 3 and 5, output "FizzBuzz". For increments of neither 3 or 5, output the number.
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
FizzBuzz.php
FizzBuzzTest.php
README.md
example.php

README.md

  • Iterate from 1 to 100.
  • For increments of 3, output "Fizz".
  • For increments of 5, output "Buzz".
  • For increments of 3 and 5, output "FizzBuzz".
  • For increments of neither 3 or 5, output the number.

Example:

FizzBuzz
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz