***** ***** ==================== 1 22 333 4444 55555 if n=5 ======================= 1 12 123 1234 12345 =========================== 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ======================== // Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; class Main { public static void main(String[] args) { System.out.println("Try programiz.pro"); Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ System.out.print(j); } System.out.println(); } } } =================================================== 5 120 === 4 24 ========================================== // Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; class Main { public static void main(String[] args) { System.out.println("Try programiz.pro"); Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int count=1; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ System.out.print(count+" "); count++; } System.out.println(); } } } ====================================================