Can someone tell me how I can change the values of x and y to '*' and '.'? Making the variables string doesn't help because I need N to be an integer as it is user input, and will conflict in loop.
import java.util.Scanner;
public class nvalue
{
public static void main(String[] args)
{
int x, y, N;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter Value of N : ");
N = keyboard.nextInt();
for(x=2; x<=N; x++)
{
for(y=1; y<=5; y++)
{
System.out.println(y +" * "+ x + " = " + (x*y));
}
System.out.println("----------------------");
}
}
}
Basically I need it to output this:
* * * * * *
. * * * * *
. . * * * *
. . . * * *
. . . . * *
. . . . . *