annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

fizbuzz - a simple coding challenge

I read today's Coding Horror blog titled "How to Hire a Programmer", then followed a link to another titled "Why Can't Programmers... Program?"  It was in the second one that I read "[...] 199 out of 200 applicants for every programming job can't write code at all. I repeat: they can't write any code whatsoever."  The author meant that quite literally.  He then suggested a simple coding test to weed out the non-programmers:

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

The comment that got me to write a solution was "Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes."  Could I write this in just a minute or two (or three)?  I wasn't too surprised that I could, and I expect that many of y'all can, too.

 

This would be a good test for folks that are just beginning (students, I'm talking to you).  Perhaps you've passed the CLAD (or CLD) and are feeling pretty good about yourself.  Try it, you may like it.

 

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Messaggio 1 di 41
24.356Visualizzazioni

A nice task I hope I solved without any Rube Goldberg codeSmiley Felice

 

FizzBuzz.png 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
Messaggio 2 di 41
24.344Visualizzazioni

Mine was similar:

  

Spoiler
fizbuzz.png

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Messaggio 3 di 41
24.336Visualizzazioni
Spoiler
FizzBuzz.png
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Messaggio 4 di 41
24.331Visualizzazioni

Henrik,

 

This is not a code obfuscation contest!  😄

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Messaggio 5 di 41
24.325Visualizzazioni

I haven't tested it for speed, however I wanted to avoid two quotient&remainder vis  😄

How about a one line regular expression someone?

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Messaggio 6 di 41
24.318Visualizzazioni

Mine's v.similar to jcarmody's, but slightly more convoluted thanks to the select VIs Smiley Triste

 

Spoiler
Fizzbuzz.JPG

 

 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Messaggio 7 di 41
24.317Visualizzazioni

@Henrik Volkers wrote:

I haven't tested it for speed, however I wanted to avoid two quotient&remainder vis 


I was referring to your first solution.


@Henrik Volkers wrote:

 

How about a one line regular expression someone? 


Hmmm...

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Messaggio 8 di 41
24.314Visualizzazioni

@ChrissyC87 wrote:

Mine's v.similar to jcarmody's, but slightly more convoluted thanks to the select VIs Smiley Triste


Don't be :(.  You just beat 199 out of 200 people applying for a programming job.  🙂

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Messaggio 9 di 41
24.314Visualizzazioni

@Even Deejay wrote:

A nice task I hope I solved without any Rube Goldberg codeSmiley Felice

 

FizzBuzz.png 


Still small thing you have that kind. You could have used Equal2Zero.png instead of Equal2Zero - 1.png. Smiley Strizza l'occhio

-----

The best solution is the one you find it by yourself
Messaggio 10 di 41
24.312Visualizzazioni