Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FizzBuzz
#1
Reply
#2
Reply
#3
 Pretty lame code (C++)
 Bonus points? Random generator
Derp. I don't know. Even forgot a continue.

Spaz Wrote:Now for a more interesting question: give an example of a string where printing the result of the standard string reverse algorithm does not give what you might consider the reverse of the string.

 ???
Reply
#4
Yayyyy Python!

Code:
for i in range(1, 101):
    if (i % 3 == 0) and (i % 5 == 0):
        print("FizzBuzz")
    elif (i % 3 == 0):
        print("Fizz")
    elif (i % 5 == 0):
        print("Buzz")
    else:
        print(i)

Do people seriously apply for programming jobs when they can't program?!

I was worried about my programming ability when I get a job, but I can definitely write programs that are this simple with no effort o_o

As for the strings question... I'm guessing it involves a special character?
Reply
#5
Jedward Wrote:Derp. I don't know. Even forgot a continue.

Those are unnecessary.
Reply
#6
 classic C - write-only style
Reply
#7
Locked Wrote:Those are unnecessary.

The continues? Yes they are.

 Output without continues
Reply
#8
I would totally do the same way as Heidi's, but in the range (0, 100) instead =P.
Reply
#9
Jedward Wrote:The continues? Yes they are.

They are only necessary because you didn't use "else if".

Generally speaking, "continue" and "break" should only be used when it would require convoluted logic to avoid them, as they are a form of the dread "goto".
Reply
#10
 Spoiler
Reply
#11
Reply
#12
Not all languages support Unicode like that.
Reply
#13
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)