Restructuring

This commit is contained in:
2024-07-01 13:49:44 +00:00
parent f11b705ef0
commit 8d60e1b905
194 changed files with 1296 additions and 112 deletions

View File

@ -0,0 +1,17 @@
title: FizzBuzz
url: http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/
desc: The classical coding 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.
solution: See the code...
solutions:
solve.php:
desc: Basic solution
language: php
solve.rb:
desc: Basic solution in Ruby
language: ruby
solve.c:
desc: ANSI C solution (Tested with TCC)
language: c

View File

@ -0,0 +1,22 @@
#include <stdio.h>
int main( )
{
int i = 0;
for(i = 1; i <= 100; i++)
{
if(i % 3 == 0)
{
printf( "Fizz" );
}
if(i % 5 == 0)
{
printf( "Buzz" );
}
if(i % 3 && i % 5)
{
printf( "%d", i );
}
printf( "\n" );
}
}

View File

@ -0,0 +1,13 @@
<?php
for($i=1; $i<=100; $i++) {
if($i % 3 == 0) {
print "Fizz";
}
if($i % 5 == 0) {
print "Buzz";
}
if($i % 3 AND $i % 5) {
print $i;
}
print PHP_EOL;
}

View File

@ -0,0 +1,12 @@
(1..100).each do |i|
if(i % 3 == 0)
print "Fizz";
end
if(i % 5 == 0)
print "Buzz"
end
if(i % 3 != 0 and i % 5 != 0)
print i
end
print "\n";
end