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 3 of 3

Thread: Major Help Needed!

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation Major Help Needed!

    Write an application to: Print the 5 times table (5 * 1 = 5, 5* 2 =10, .. 5 * 12 = 60) Format of output 5 * 1 = 5 5 * 2 = 10 etc. Hint: Write the Java code to print the line for the 4th row, use a variable rowof type intto hold the value 3 Then using the value held in row print the 4th line. 4 * 3 = 20 Enclose these statements in a loop that varies the contents of rowfrom 1 to 12.


    how do I do this?! ideas anyone PLEASE?!!


  2. #2
    Forum VIP
    Join Date
    Oct 2010
    Posts
    275
    My Mood
    Cool
    Thanks
    32
    Thanked 54 Times in 47 Posts
    Blog Entries
    2

    Default Re: Major Help Needed!

    So you are going to need to use either a for loop (I recommend for this) or a while loop.
    Help with for loops
    In order to get the multiples of x you use xN, x(N+1), x(N+2) ect, EG: The multiples of 5 are 5(1), 5(1+1), 5(1+2) etc. or the multiples of 2 beggining with 6 are 2(3), 2(3+1), 2(3+2) etc. So assuming you want to go up to 12, you need something that prints using that basic format.
    int multiplesOf = 5, counter = 0; //This is what your going to get the multiples of.
    for(int n = 1; n <= 12; n++) //The for loop, using n as our counter
    { //Begin for loop
        System.out.println(multiplesOf + " * " + (n+counter) + " = " + (multiplesOf*(n+counter))); //Print the answer out (5 * 2 = 10)
    }// End for loop

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    18
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Major Help Needed!

    I still don't get it?!

    I hate thisss!!

Similar Threads

  1. help!!!! needed!! please
    By isuckatprogramming in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 22nd, 2011, 03:20 PM
  2. HELP NEEDED
    By nicola177 in forum Java Theory & Questions
    Replies: 1
    Last Post: March 4th, 2011, 10:17 AM
  3. need help in major project
    By h313 in forum The Cafe
    Replies: 1
    Last Post: August 1st, 2010, 10:58 AM
  4. [SOLVED] Help needed!
    By subhvi in forum Web Frameworks
    Replies: 4
    Last Post: February 18th, 2010, 08:26 AM
  5. [SOLVED] A little help needed..
    By JavaStudent87 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 22nd, 2010, 05:54 PM