- 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++; } } }

26th Oct 2016, 4:37 PM
Sherab Dorji
Sherab Dorji - avatar
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
8th Nov 2016, 6:25 AM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar