Java for loop display pattern 1

Question

We would like to use for loop to display pattern.

0 
0 2 
0 3 6 
0 4 8 12 
0 5 10 15 20 
0 6 12 18 24 30 
0 7 14 21 28 35 42 
0 8 16 24 32 40 48 56 
0 9 18 27 36 45 54 63 72 

public class Main {
  public static void main(String[] args) {
    //your code 

  }
}



public class Main {
  public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < i; j++) {
        System.out.print(i * j+" ") ;
      } 
      System.out.println() ;
      
    }  

  }
}



PreviousNext

Related