[ create a new paste ] login | about

Link: http://codepad.org/yXCVhy82    [ raw code | output | fork ]

PHP, pasted on Aug 29:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

for($i=1; $i<100; $i++)
{
    if($i % 3)
    {
        echo "[3, {$i}] Fizz\n";
    }
    elseif($i % 5)
    {
        echo "[5, {$i}] Buzz\n";
    }
    elseif(($i % 3) && ($i % 5))
    {
        echo "[*, {$i}] Fizz Buzz\n";
    }
}


Output:
[3, 1] Fizz
[3, 2] Fizz
[5, 3] Buzz
[3, 4] Fizz
[3, 5] Fizz
[5, 6] Buzz
[3, 7] Fizz
[3, 8] Fizz
[5, 9] Buzz
[3, 10] Fizz
[3, 11] Fizz
[5, 12] Buzz
[3, 13] Fizz
[3, 14] Fizz
[3, 16] Fizz
[3, 17] Fizz
[5, 18] Buzz
[3, 19] Fizz
[3, 20] Fizz
[5, 21] Buzz
[3, 22] Fizz
[3, 23] Fizz
[5, 24] Buzz
[3, 25] Fizz
[3, 26] Fizz
[5, 27] Buzz
[3, 28] Fizz
[3, 29] Fizz
[3, 31] Fizz
[3, 32] Fizz
[5, 33] Buzz
[3, 34] Fizz
[3, 35] Fizz
[5, 36] Buzz
[3, 37] Fizz
[3, 38] Fizz
[5, 39] Buzz
[3, 40] Fizz
[3, 41] Fizz
[5, 42] Buzz
[3, 43] Fizz
[3, 44] Fizz
[3, 46] Fizz
[3, 47] Fizz
[5, 48] Buzz
[3, 49] Fizz
[3, 50] Fizz
[5, 51] Buzz
[3, 52] Fizz
[3, 53] Fizz
[5, 54] Buzz
[3, 55] Fizz
[3, 56] Fizz
[5, 57] Buzz
[3, 58] Fizz
[3, 59] Fizz
[3, 61] Fizz
[3, 62] Fizz
[5, 63] Buzz
[3, 64] Fizz
[3, 65] Fizz
[5, 66] Buzz
[3, 67] Fizz
[3, 68] Fizz
[5, 69] Buzz
[3, 70] Fizz
[3, 71] Fizz
[5, 72] Buzz
[3, 73] Fizz
[3, 74] Fizz
[3, 76] Fizz
[3, 77] Fizz
[5, 78] Buzz
[3, 79] Fizz
[3, 80] Fizz
[5, 81] Buzz
[3, 82] Fizz
[3, 83] Fizz
[5, 84] Buzz
[3, 85] Fizz
[3, 86] Fizz
[5, 87] Buzz
[3, 88] Fizz
[3, 89] Fizz
[3, 91] Fizz
[3, 92] Fizz
[5, 93] Buzz
[3, 94] Fizz
[3, 95] Fizz
[5, 96] Buzz
[3, 97] Fizz
[3, 98] Fizz
[5, 99] Buzz


Create a new paste based on this one


Comments: