Author Topic: Can the Blockland Forums pass the Fizz Buzz test?  (Read 2601 times)

"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”."

Please use the code tags :|.




wtf no

do you expect blf has the mentality for this lol

Code: [Select]
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizzbuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 Fizzbuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 Fizzbuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 Fizzbuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 Fizzbuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 Fizzbuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz
this isn't hard lol

Code: [Select]
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 Fizzbuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 Fizzbuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 Fizzbuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 Fizzbuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 Fizzbuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 Fizzbuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz
this isn't hard lol
topic finished, lol

topic finished, lol

exactly, everybody can just copy it now.

Code: [Select]
int maxNumber = 100;
for(int i = 0; i < maxNumber;i++)
{
   string fizzorbuzz = "";
   if(i % 3 == 0) //Now we check if it is dividable by 3
   {
      fizzorbuzz += "Fizz";
   }
   if(i % 5 == 0) //Now we check if it is dividable by 5
   {
      fizzorbuzz += "Buzz";
   }
   if(fizzorbuzz != "")
      print(fizzorbuzz);
   else
      print(i);
}
(Edited it due to i forgot to print the numbers if it wasn't dividable by any of both)
The method print is filled with whatever the programming language uses to print in the console or whatever and prints the parameter.

kthnxbai.

EDIT:
exactly, everybody can just copy it now.
You guys didn't read.
But oh well.
« Last Edit: July 15, 2012, 07:09:10 AM by lordician »

Code: [Select]
int maxNumber = 100;
for(int i = 0; i < maxNumber;i++)
{
   string fizzorbuzz = "";
   if(i % 3 == 0) //Now we check if it is dividable by 3
   {
      fizzorbuzz += "Fizz";
   }
   if(i % 5 == 0) //Now we check if it is dividable by 5
   {
      fizzorbuzz += "Buzz";
   }
   print(fizzorbuzz);
}
The method print is filled with whatever the programming language uses to print in the console or whatever and prints the parameter.

kthnxbai.

EDIT:You guys didn't read.
But oh well.

i...i don't get this at all.
i still think it's easier to just solve this instead of writing a script for it.

What if it is about numbers between 1 and a million?
Good luck there.

WHat if it is about numbers between 1 and a million?
Good luck there.

yeah, but this is only between 1 and 100.

yeah, but this is only between 1 and 100.
Programmers think ahead.
That is why i included the maxNumbers variable.

So that people can easily try a much larger number. :)

i...i don't get this at all.
i still think it's easier to just solve this instead of writing a script for it.
it says in the OP to write a program

he was following the instructions, you werent

it says in the OP to write a program

he was following the instructions, you werent

oh. oh wow i totally misunderstood that lol