BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

fizbuzz - a simple coding challenge

Would it be cheating to just make an array constant of

 

1

2

fizz

4

buzz

......

 

and wire it to an indicator?

Message 21 of 41
(10,451 Views)

@Hornless.Rhino wrote:

Would it be cheating to just make an array constant of

 

1

2

fizz

4

buzz

......

 

and wire it to an indicator?


:rofl

 

I love it. Smiley LOL

0 Kudos
Message 22 of 41
(10,441 Views)

This is my approach for this problem.

 

 FizzBuzz.jpg

0 Kudos
Message 23 of 41
(10,315 Views)

@LongTran wrote:

This is my approach for this problem.


Except for the fact that your string won't show any numbers...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 24 of 41
(10,310 Views)

Numeric 2 shows the number and it is easy to add the number to the concatenated string.

0 Kudos
Message 25 of 41
(10,292 Views)

@LongTran wrote:

Numeric 2 shows the number and it is easy to add the number to the concatenated string.


Well, it is easy to write a program from scratch that fulfills all requirements of the challenge and yours does not even come close. 😄

 

  • You are slowly displaying a partial result, replacing the previous result. "Printing" implies that all results are visible once the program completes.
  • What is the point of the upper numeric indicator?
  • Your program takes 100 seconds to complete. That is longer than it should take to solve the challenge.
  • You have way too much duplicate code. Why do you need two copies of an empty string, for example?
  • Your code operates on numbers 0 ... 99 instead of 1 ... 100 as required.
  • ...
  • Fail!
0 Kudos
Message 26 of 41
(10,307 Views)

Hi altenbach,

 

Thanks for your detailed post. I am new and learning so it helps me a lot.

0 Kudos
Message 27 of 41
(10,295 Views)

I tried to do it with no case structures and with the return being a single string indicator, not an array.  (Full disclosure: I totally stole the array input to Q&R from altenbach).

FizzBuzz.png

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Message 28 of 41
(10,228 Views)

Not that I want to keep banging on about it, but if you can solve the fizz buzz challenge then you can solve the first problem at Project Euler. If you haven't come across it, take a look.

 

http://projecteuler.net/problem=1

---
CLA
0 Kudos
Message 29 of 41
(10,192 Views)

No-one tried this?

 

Capture.PNG

PS: Don't mind the numeric conversions..

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 30 of 41
(10,163 Views)