FizzBuzz

Posted by s on April 26, 2008, 2:33 p.m.

int a=0;

void setup(){while(a++<100){

if(a%3==0){print("Fizz");}

if(a%5==0){print("Buzz");}else{if(a%3>0){print(a);}}

print(" ");}}

So I was reading random things about programming because that's what I do on my free time and I came across a person talking about hiring. The conclusion was "Most programmers can't program". Why?

It took many programmers 10 to 15 minutes to program fizzbuzz

Make a program that counts from 1 to 100, stating the value. However, if the value is divisible by 3, make it instead state "Fizz" and if the number is divisble by 5, make it instead state "Buzz". In the case of both, make it state "FizzBuzz"

And of course GML, instead of p5

s="";v=0

while(v<100){v+=1

if v mod 3=0{s+="Fizz"}}

if v mod 5=0{s+=Buzz}else{if v mod 3=0{s+=string(v)}}

show_message(s)

(Ya, just needed to restate what some couldn't figure. No matter what language, the code doesn't have time to change)

So ya, gives me hope (in a cruel sense). One must not be good at something, simply better

(That being said, I still need to look into standard Java and ya, I suppose dancing around with that C thing would do me some good)

Comments

PY 17 years ago

C#'s a good language, though it forces ;'s

You'd like it, I think, there's a lot of ways to optimise it, and a hell of a lot of power in there.

s 17 years ago

Seems like one of those nuisance languages that lack the easy access, but I suppose I could give more effort into looking around

PY 17 years ago

Yeah, it's not as simple as others…

On a side note, I recently moved to miranda-im.

s 17 years ago

Thank you for mentioning it, I just spent a few minutes on it again and got it working. Beautiful interface

PY 17 years ago

It is, rather.

Lovely peice of softawr, and fast, too.

s 17 years ago

Too bad it has to freeze input while a message sends. I'm into stream of concious typing, where I jot down an idea and hit ENTER, causing a more stream like chat. Luda does the same, causes us to talk in depth of things. We're able to react to the other's streams, changing what our stream is saying while reading the other