QUOTE(mezig101 @ 17 Aug, 2007 - 03:20 PM)

Hi, Im working on a program using loops but I can't seem to get it right..I need help.
Im suppose to make a multiplication table using the for loops but it's not working..I've done\
\
[ import java.util.Scanner;
class Pictures
{
void printTable(int rows, int col)
{
for(int row = 1; row <= 1; row++)
{
for(int column = 1; col <= 1; col++)
System.out.print("");
System.out.println();
}
for(int row = 2; row <=5; row++)
{
for(int column = 2; col <= 7; col++)
System.out.print(row);
System.out.print(col);
System.out.println();
}
}
}
public class PictureTester
{
public static void main (String[ ] args)
{
Pictures pic = new Pictures ( );
Scanner in = new Scanner(System.in);
String get;
pic.printTable (4, 6);
get = in.nextLine ( ); // freezes the output screen to see the picture
pic.printTable (11,12);
get = in.nextLine ( );
}
}
]
but it's wrong..the outcome needs to be something like
Sample run output for printTable (4, 6):
1 2 3 4 5 6
1 1 2 3 4 5 6
2 2 4 6 8 10 12
3 3 6 9 12 15 18
4 4 8 12 16 20 24
but didn't work

plz tell me what i need to do and explain loops to me
ok sooo i figured as far as getting all the numbers but idk how to start the new line
import java.util.Scanner;
class Pictures
{
void printTable(int rows, int col)
{
for(int row = 1; row <= 6; row++)
{
for(int column = 1; column <= 7; column++)
{
System.out.print(row*column);
}
}
}
}
public class PictureTester
{
public static void main (String[ ] args)
{
Pictures pic = new Pictures ( );
Scanner in = new Scanner(System.in);
String get;
pic.printTable (4, 6);
get = in.nextLine ( ); // freezes the output screen to see the picture
pic.printTable (11,12);
get = in.nextLine ( );
}
}