# Major Help Needed!

• August 12th, 2011, 08:51 PM
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?!!
• August 13th, 2011, 12:15 AM
Tjstretch
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.
Code Java:

```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```
• August 13th, 2011, 10:03 AM
Re: Major Help Needed!
I still don't get it?!

I hate thisss!!