Use nested loops. Here is the basic structure for one that goes up to 9. You can change the limit with user input which I assume you know how to do.
public static void main(String[] args)
{
int baseNum=1;
int multNum=1;
int numBorder=1;
System.out.println (" 1 2 3 4 5 6 7 8 9");
while(baseNum<=9)
{
System.out.print (numBorder);
while(multNum<=9)
{
System.out.print(" "+baseNum*multNum);
multNum++;
}
System.out.print ("\n");
numBorder++;
baseNum++;
multNum=1;
}
}