0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Code: QBASIC
FOR I = 1 TO 100
    Flag = 0
    IF I MOD 3 = 0 THEN PRINT "FIZZ"; : Flag = 1
    IF I MOD 5 = 0 THEN PRINT "BUZZ"; : Flag = 1
    IF Flag = 0 THEN PRINT I;
    PRINT ""
NEXT I
END
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Code: Java
for(int i = 0 ; i <= 100 ; i++)
{
    if(i % 3 == 0 && i % 5 == 0)
    {
        System.out.println("FizzBuzz");
    }
    else if(i % 3 == 0)
    {
        System.out.println("Fizz");
    }
    else if(i % 5 == 0)
    {
        System.out.println("Buzz");
    }
    else
    {
        System.out.println(i);
    }
}
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Quote:
Originally Posted by SaswatPadhi View Post
Finalllyyyy... After struggling with BrainF*ck for 3 hours, I conclude that the language truly justifies its name !
Heh, well done there. I was trying to put a Brainf*ck one together but gave up after well over 3 hours.
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Thanx !

Programming with Brainf*ck requires a lot of patience. While writing this code, many times it came to me "Why should I write it ?". I was ready to give up, but then I thought I had no better way to utilize my time ! But, BF truely f*cks Brain.

Last edited by SaswatPadhi; 1Jun2009 at 18:32..
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Check this out guys http://golf.shinh.org/p.rb?FizzBuzz
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
OMG !!!

Whitespace, Befunge !
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
The program in Mathematica 7
Code: Mathematica
For[i = 1, i < 101, i++, If[Mod[i, 3] == 0, If[Mod[i, 5] == 0, Print["FIZZBUZZ"], Print["FIZZ"]], If[Mod[i, 5] == 0, Print["BUZZ"], Print[i]]]]
0
develosapiens's Avatar, Join Date: May 2015
Newbie Member
Hi,
It is a very old thread but who cares

I think it is a good idea to write code in a certain language more than once because as every coder makes a different solution. I am a java programmer and I wrote about fizz buzz game in my blog here: develosapiens.wordpress.com/2015/05/08/fizz-buzz/ I think that code maintenance is more important than the short code. As you can see it in my code -linked before- I created the source in separated files because of easy maintenance requirements. What do you think?