[Solved] JAVA broken while loop


Mike you Have to use diffrent variables for difflent loop control.

create an “n” and it should work

Scanner stdin = new Scanner(System.in);
System.out.println("Enter number of rows and columns: ");

int row = stdin.nextInt();
int column = stdin.nextInt();

int m = 1;
int n = 1;

while(m <= column)
{
    while(n <= row)
    {
        System.out.println("*\t");
        n++;
    }
    System.out.print("*");
    m++;
}

4

solved JAVA broken while loop