Loops = 4
Built-in Functions = 2
Conditionals = 2
Variables = 1
The lowest score wins - creativity is also awarded. The first competition is to create a FizzBuzz application.
The language is up to you, there will be an overall winner and a language specific winner. The winner gets nothing but it's funWrite 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”.
Here's my entry:
Code: Select all
array_walk(range(1, 100),'fizzbuzz');
function fizzbuzz($num){
print (($num % 3 == 0) ? 'Fizz'. (($num % 5 == 0) ? 'Buzz' : '') : (($num % 5 == 0) ? 'Buzz' : $num)) .' ';
}