Page 1 of 1 [ 7 posts ] 


How long did it take to code this?
I can code and this took longer than expected. 25%  25%  [ 3 ]
I can code and this took less time than expected. 25%  25%  [ 3 ]
I can code and this took the expected amount of time. 50%  50%  [ 6 ]
Total votes : 12

starkid
Veteran
Veteran

User avatar

Joined: 9 Feb 2012
Gender: Female
Posts: 5,812
Location: California Bay Area

22 May 2014, 2:59 pm

In any language. How long did it take you?

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

Using FizzBuzz to Find Developers who Grok Coding



Kurgan
Veteran
Veteran

User avatar

Joined: 6 Apr 2012
Age: 35
Gender: Male
Posts: 4,132
Location: Scandinavia

22 May 2014, 3:02 pm

This is nothing more than a for loop and three if statements that check the modulo of the incremented number.


_________________
“He who controls the spice controls the universe.”


starkid
Veteran
Veteran

User avatar

Joined: 9 Feb 2012
Gender: Female
Posts: 5,812
Location: California Bay Area

22 May 2014, 3:10 pm

Don't give it away!



Kiriae
Veteran
Veteran

User avatar

Joined: 30 Mar 2014
Age: 35
Gender: Female
Posts: 2,349
Location: Kraków, Poland

22 May 2014, 4:21 pm

I can't currently code but about 10 years ago I was learning some programming in school and if I only remember the functions I could easily write a program like this. I can see what to do in what order and basically I see the whole program in my head. It is a simple loop. I remember I was doing something similar and it wasn't hard at all.

It would be something like:
a=1
while a=<100 do b=a/3, c=a/5,
if b=/=whole figure and c=/=whole figure print a,
if b=whole figure and c=/=whole figure print "Fizz",
if b=/=whole figure and c=whole figure print "Buzz",
if b=whole figure and c=whole figure print "FizzBuzz",
a=a+1,
repeat while.

Writing this took me like 2 mins (including thinking and remembering). I just don't remember how to check the "whole figure" thing but considering I last worked with the language 10 years ago, it was only like 3 months of 1 hour a week in my high school and I don't even know what the language was called I quess I did well anyway.



beneficii
Veteran
Veteran

User avatar

Joined: 10 May 2005
Age: 40
Gender: Female
Posts: 7,245

22 May 2014, 6:33 pm

With C++. It took me about as long as I expected to code this:

EDIT: I see the post now where I'm not supposed to give it away.


_________________
"You have a responsibility to consider all sides of a problem and a responsibility to make a judgment and a responsibility to care for all involved." --Ian Danskin


Magneto
Veteran
Veteran

User avatar

Joined: 12 Jun 2009
Gender: Female
Posts: 2,086
Location: Blighty

23 May 2014, 5:10 am

Ah, I love Python. Easy to spot my mistake (I needed an elif, not an if...).

I didn't take me that long to do.



MaxE
Veteran
Veteran

User avatar

Joined: 2 Sep 2013
Gender: Male
Posts: 5,267
Location: Mid-Atlantic US

26 May 2014, 10:34 am

Took about 3-4 minutes in Java. Mostly due to typing errors.

I need a plugin to get Eclipse to emulate VI for editing - I was always able to type faster that way.