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

1. ## 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. ## 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. ## Re: Major Help Needed!

I still don't get it?!

I hate thisss!!