I have declared and initialized the variable outside the loop instead of after the first while.
is is because of that I am getting the error...if so,how and why that makes a difference.kindly clarify
package en.codegym.task.pro.task04.task0404;
/*
Filled rectangle
*/
public class Solution {
public static void main(String[] args) {
//write your code here
int height = 0;
int width = 0;
while (height < 5){
while (width < 10){
System.out.print("Q");
width++;
}
System.out.println();
height++;
}
}
}