Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Java Tutorial 10 : "Fizz Buzz"

Loading...

Sign in or sign up now!
5,472
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 15, 2008

Take the Fizz Buzz challenge:

-Create an application that counts from 1 to 100
-When the number is a multiple of 3, print "Fizz" to the screen instead of the number
-When the number is a multiple of 5, print "Buzz"
-When the number is both a multiple of 3 and 5, print "FizzBuzz" to the screen

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (TruthBeautyGoodness)

  • I took a semester learning MatLAB, (similar to C+ i think ?) Downloaded Eclipse, tried to use their tutorials, and their program is a different version then their help files i think. I came across your videos, and ran through them in a very short time and you got me up to speed. thank you... really good job on these. love this Fizz Buzz Test too.

    Do you ever use eclipse?

    Thank you again.

  • I'm glad they helped. I've only used Eclipse through JBuilder at school (I'm pretty sure JBuilder is based off of Eclipse). But I'm not nearly experienced enough to make use of all the tools that Eclipse offers and I find they usually just get in the way so I use JEdit or Notepad most often.

see all

All Comments (10)

Sign In or Sign Up now to post a comment!
  • Thanks! I did it in a few minutes. However, I only used 2 variables and created a for loop and used a switch inside of it.

  • SWEET!! I was actually able to create my own way of doing FizzBuzz! THANK YOU!

    Wouldn't have been able to do it without you!

  • I've watched every video up to this point until I understand it. This is fawesome. I'm working on learning this so I can convert a bash script which reads data from my car into a java program which is cross platform.

    I hope this tutorial gets into reading serial devices, or accessing computer devices.

  • Took me a while to find a solution, but when I did, I also discovered a new way to get only the decimals from a double.

    I use a for loop with an initial variable of type double called a. I create a new String, then check if (int) a/3 equals a/3. If true, then I add Fizz. Then I check if (int) a/5 equals a/5. If true, I add Buzz. If my String is empty, I add (int) a. Then I println the String. ;)

    Oh and the way to get the decimals from the double was to do myDouble - (int) myDouble.

    5/5

  • Awesome tut, i''m learning so much. I took the base of fizzbuzz script to output numbers 1 - 100 printing each number & to the side telling whether its even or odd.

  • That's good!

    If you get the same output, you're not wrong but right.

    Less code is more efficient, that's all

  • haha i did it the longest way possible

    i made a crapload of or statements with an if else

    but hell it worked

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more