- 1
Why the first loop not working?
public class Program { public static void main(String[] args) { int a = 1; int b= 1; while (a <= 11){ while (b<= 10){ System.out.println(a + "x" + b + "=" + a*b); b++; } a++; } } }
1 Answer
0
public class Program
{
public static void main(String[] args) {
int a = 1;
int b;
while (a <= 11){
b= 1;
while (b<= 10){
System.out.println(a + "x" + b + "=" + a*b);
b++;
}
System.out.println();
a++;
}
}
}
It works fine .The second loop run only once..Now it is corrected