Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Help with factorials!

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with factorials!

    Hey all,

    I am in AP Computer Science online, so it is hard to get immediate feedback from anyone in my classroom. When they do eventually respond, it is usually too technical for me to follow.

    Anyway, I am trying to calculate factorials using BlueJ. All of my factorials calculate correctly, I am just having an issue with something the instructor asked of us. She asked us to force the loop to stop when the user inputs "Calculate the factorial of 0", and not give any print.

    So far I have my for loop with the correct conditions, I am just really confused as to how to make an if statement to stop the code when the input is 0. Thanks!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Help with factorials!

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Perhaps you could use an if() statement with a break.

Similar Threads

  1. Sum of Factorials
    By tmt in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 11th, 2014, 12:25 AM
  2. A few tips in the direction of a lottery game, factorials
    By hholco in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 8th, 2013, 03:34 AM

Tags for this Thread