Number Pattern Ondhupackage com.jaladhi;import java.util.Scanner; public class Ondhu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 |
Number Pattern Yeradupackage com.jaladhi;import java.util.Scanner; public class Yeradu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(i + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 |
Number Pattern Moorupackage com.jaladhi;import java.util.Scanner; public class Mooru { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } System.out.println(); } for (int i = rows; i >= 1; i--) { for (int j = 1; j < i; j++) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 |
Number Pattern Naalkupackage com.jaladhi;import java.util.Scanner; public class Naalku { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } System.out.println(); } for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 |
Number Pattern Aidhupackage com.jaladhi;import java.util.Scanner; public class Aidhu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = i; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } for (int i = 1; i ≤ rows; i++) { for (int j = i; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 |
Number Pattern Arupackage com.jaladhi;import java.util.Scanner; public class Aru { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i ≤ rows; i++) { int x = 0; int y = 1; System.out.print(y+" "); for (int j = 0; j < i; j++) { int z = x + y; System.out.print(z + " "); x = y; y = z; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 1 2 1 1 2 3 1 1 2 3 5 1 1 2 3 5 8 |
Number Pattern Elupackage com.jaladhi;import java.util.Scanner; public class Elu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print((int) Math.pow(j, i) + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 4 1 8 27 1 16 81 256 |
Number Pattern Entupackage com.jaladhi;import java.util.Scanner; public class Entu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i < rows; i++) { int num = 1; for (int j = 0; j ≤ i; j++) { if(i ==0 || j ==0) { num = 1; } else { num = num * (i - j + 1)/ j; } System.out.print(num + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 |
Number Pattern Ombattupackage com.jaladhi;import java.util.Scanner; public class Ombattu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(" "); } for (int k = 1; k ≤ i; k++) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 |
Number Pattern Hattupackage com.jaladhi;import java.util.Scanner; public class Hattu{ public static void main(String[] args) { for (int i = 1; i ≤ 3; i++) { for (int j = 1; j ≤ 3; j++) { if (i == j) { System.out.print("1 "); } if (i < j) { System.out.print("# "); } if (i > j) { System.out.print("& "); } System.out.println(); } } } |
Output :1 # #$ 1 # $ $ 1 |
Number Pattern Hannondupackage com.jaladhi;import java.util.Scanner; public class Hannondu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = rows; j >= i; j--) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1 |
Number Pattern Hanneraḍupackage com.jaladhi;import java.util.Scanner; public class Hanneraḍu { public static void main(String[] args) { for (int i = 1; i ≤ 5; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j); } for (int k = 1; k ≤ i; k++) { System.out.print("*"); } System.out.println(); } } } |
Output :1*12** 123*** 1234**** 12345***** |
Number Pattern Hadimurupackage com.jaladhi;import java.util.Scanner; public class Hadimuru { public static void main(String[] args) { for (int i = 1; i ≤ 6; i++) { int temp = i; for (int j = 1; j ≤ i; j++) { if (i % 2 == 0) { System.out.print(temp); temp--; } else { System.out.print(j); } } System.out.println(); } } } |
Output :121 123 4321 12345 654321 |
Number Pattern Hadinalkupackage com.jaladhi;import java.util.Scanner; public class Hadinalku { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j >= i; j--) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 |
Number Pattern Hadinaidupackage com.jaladhi;import java.util.Scanner; public class Hadinaidu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 |
Number Pattern Hadinaarupackage com.jaladhi;import java.util.Scanner; public class Hadinaaru { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int k = 1; System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(k + " "); k++; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Number Pattern Hadineḷupackage com.jaladhi;import java.util.Scanner; public class Hadineḷu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = i; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 |
Number Pattern Hadinentupackage com.jaladhi;import java.util.Scanner; public class Hadinentu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int temp = i; for (int j = i; j >= 1; j--) { System.out.print(temp + " "); temp = temp + rows; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 7 3 8 13 4 9 14 19 5 10 15 20 25 |
Number Pattern Hattombattupackage com.jaladhi;import java.util.Scanner; public class Hattombattu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(" "); } int temp = 1; for (int k = 1; k ≤ i; k++) { System.out.print(temp + " "); temp = temp * (i - k) / (k); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 |
Number Pattern Ippattupackage com.jaladhi;import java.util.Scanner; public class Ippattu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } for (int k = i - 1; k >= 1; k--) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 |
Number Pattern Ippattondupackage com.jaladhi;import java.util.Scanner; public class Ippattondu { public static void main(String[] args) { for (int i = 1; i ≤ 6; i++) { for (int j = 1; j ≤ i; j++) { if (i == 1) { System.out.print(i); } else if (j == i && j != 1) { System.out.print(i); } else { System.out.print(i - 1); } } System.out.println(); } } } |
Output :112 223 3334 44445 555556 |
Number Pattern Ippatmurupackage com.jaladhi;import java.util.Scanner; public class Ippattondu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int k = 1; k ≤ rows - i + 1; k++) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 |
Number Pattern Ippatnalkupackage com.jaladhi;import java.util.Scanner; public class Ippatnalku { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int k = i; k ≤ rows; k++) { System.out.print(k + " "); } System.out.println(); } for (int i = rows; i >= 1; i--) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int k = i; k ≤ rows; k++) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 |
Number Pattern Ippattaidupackage com.jaladhi;import java.util.Scanner; public class Ippattaidu { public static void main(String[] args) { for (int i = 1; i ≤ 6; i++) { for (int j = 1; j ≤ i; j++) { if (i == 1) { System.out.print(i); } else if (j == i && j != 1) { System.out.print(i); } else { System.out.print(i - 1); } } System.out.println(); } } } |
Output :112 223 3334 44445 555556 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int k = i; k ≤ rows; k++) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int j = i; for (int k = 1; k ≤ rows; k++) { System.out.print(j + " "); j++; if (j > rows) { j = 1; } } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 2 3 4 5 1 3 4 5 1 2 4 5 1 2 3 5 1 2 3 4 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = i; j ≤ rows; j++) { System.out.print(j + " "); } for(int k = i-1; k >= 1; k--) { System.out.print(k + " "); } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 2 3 4 5 1 3 4 5 2 1 4 5 3 2 1 5 4 3 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int j = (i * 2) - 1; for (int k = 1; k ≤ rows; k++) { System.out.print(j + " "); j += 2; if (j > (rows * 2) - 1) { j = 1; } } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 3 5 7 9 3 5 7 9 1 5 7 9 1 3 7 9 1 3 5 9 1 3 5 7 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int j = (i * 2) - 1; for (int k = i; k ≤ rows; k++) { System.out.print(j + " "); j += 2; } for (int l = (i * 2) - 3; l >= 1; l-=2) { System.out.print(l + " "); } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 3 5 7 9 3 5 7 9 1 5 7 9 3 1 7 9 5 3 1 9 7 5 3 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j); } for (int j= i*2 ; j < rows*2; j++) { System.out.print(" "); } for (int l = i; l >= 1; l--) { System.out.print(l); } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 12 21 123 321 1234 4321 1234554321 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int k = i; k ≤ rows; k++) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(" "); } for (int k = 1; k ≤ i; k++) { System.out.print(k); } for (int l = i - 1; l >= 1; l--) { System.out.print(l); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 121 12321 1234321 123454321 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j % 2 + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j < i; j++) { System.out.print("0 "); } System.out.print(i + " "); for (int k = i; k < rows; k++) { System.out.print("0 "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 0 4 0 0 0 0 0 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(1 + " "); } for (int k = 1; k ≤ i; k++) { System.out.print(i + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 1 1 1 1 2 2 1 1 3 3 3 1 4 4 4 4 5 5 5 5 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = i; j ≤ rows; j++) { System.out.print(j + " "); } for (int k = rows - 1; k >= i; k--) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 3 4 5 4 3 4 5 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(" "); } for (int k = 1; k ≤ i; k++) { System.out.print(i + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = i; j < rows; j++) { System.out.print(j + " "); } for (int k = rows - i; k < rows; k++) { System.out.print(5 + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 5 5 5 5 4 5 5 5 5 3 4 5 5 5 2 3 4 5 5 1 2 3 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int k = 1; System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { k=i; for (int j = 1; j ≤ i; j++) { System.out.print(k + " "); k = k + rows - j; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 6 3 7 10 4 8 11 13 5 9 12 14 15 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 1; for(int i=1; i ≤ rows/2+1; i++) { for(int j=1;j ≤ i;j++) { System.out.print(temp * j + " "); } System.out.println(); temp++; } for(int i=1; i ≤ rows/2; i++) { for(int j=1;j ≤ rows/2+1-i;j++) { System.out.print(temp*j+" "); } System.out.println(); temp++; } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 4 3 6 9 4 8 12 16 5 10 15 6 12 7 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i < rows; i++) { for (int j = 0; j ≤ i; j++) { if (j % 2 == 0) { System.out.print(1 + j * rows - (j - 1) * j / 2 + i - j + " "); } else { System.out.print(1 + j * rows - (j - 1) * j / 2 + rows - 1 - i + " "); } } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 9 3 8 10 4 7 11 14 5 6 12 13 15 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i < rows; i++) { for (int j = 0; j < rows; j++) { if (j % 2 == 0) { System.out.print((rows * (j)) + i + 1 + " "); } else { System.out.print((rows * (j + 1)) - i + " "); } } System.out.print("\n"); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 10 11 20 21 2 9 12 19 22 3 8 13 18 23 4 7 14 17 24 5 6 15 16 25 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int temp = 0; System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = rows ; j >= i; j--) { System.out.print(j + " "); temp = j; } for (int k = rows - i+1; k < rows; k++) { System.out.print(temp + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 5 5 5 5 5 4 4 4 4 5 4 3 3 3 5 4 3 2 2 5 4 3 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int temp = 0; System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int a = 0; int b = 1; for (int j = 1; j ≤ i; j++) { int c = a + b; System.out.print(c + " "); a = b; b = c; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 2 3 1 2 3 5 1 2 3 5 8 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int temp = 0; System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = i; j ≤ rows; j++) { System.out.print(j + " "); } for (int k = rows-1; k >= i; k--) { System.out.print(k + " "); } System.out.println(); } for (int i = 2; i ≤ rows; i++) { for (int j = i; j ≤ rows; j++) { System.out.print(j + " "); } for (int k = rows-1; k >= i; k--) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 5 4 3 4 5 4 3 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 3 4 5 4 3 4 5 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i=1; i ≤ rows; i++) { if (i % 2 == 0) { int reverse = currentRow + counter - 1; for (int j = 0; j < i; j++) { System.out.print(reverse-- +" "); counter++; } } else { for (int j = 1; j ≤ i; j++) { System.out.print(counter +" "); counter++; } } System.out.println(); currentRow++; } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 3 2 4 5 6 10 9 8 7 11 12 13 14 15 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i=1; i ≤ rows; i++) { if (i % 2 == 0) { for (int j = 1; j ≤ i; j++) { System.out.print(counter +" "); counter++; } } else { int reverse = currentRow + counter - 1; for (int j = 0; j < i; j++) { System.out.print(reverse-- +" "); counter++; } } System.out.println(); currentRow++; } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 6 5 4 7 8 9 10 15 14 13 12 11 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = rows; j >= 1+rows-i; j--) { System.out.print(j); } for (int j= i*2 ; j < rows*2-1; j++) { System.out.print(" "); } for (int l = 1+rows-i; l ≤ rows; l++) { if(l!=1) { System.out.print(l); } } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 543212345 5432 2345 543 345 54 45 5 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = 1; j ≤ i; j++) { System.out.print(j); } for (int j= i*2 ; j < rows*2-1; j++) { System.out.print(" "); } for (int l = i; l >= 1; l--) { if(l!=rows) { System.out.print(l); } } System.out.println(); } scanner.close(); } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 123454321 1234 4321 123 321 12 21 1 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } for (int k = i - 1; k >= 1; k--) { System.out.print(k + " "); } System.out.println(); } for (int i = rows-1; i >= 1; i--) { for (int j = 1; j ≤ i; j++) { System.out.print(j + " "); } for (int k = i - 1; k >= 1; k--) { System.out.print(k + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 1 2 3 4 3 2 1 1 2 3 2 1 1 2 1 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { int temp = i; for (int j = 1; j ≤ i; j++) { System.out.print(temp + " "); temp = temp + 1; } temp = temp - 2; for (int k = i - 1; k >= 1; k--) { System.out.print(temp + " "); temp = temp - 1; } System.out.println(); } for (int i = rows - 1; i >= 1; i--) { int temp = i; for (int j = 1; j ≤ i; j++) { System.out.print(temp + " "); temp = temp + 1; } temp = temp - 2; for (int k = i - 1; k >= 1; k--) { System.out.print(temp + " "); temp = temp - 1; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5 4 5 6 7 6 5 4 3 4 5 4 3 2 3 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 1; for (int i = 1; i ≤ rows; i++) { for (int k = 1; k ≤ i; k++) { System.out.print(temp + " "); } temp++; System.out.println(); } for (int i = rows - 1; i >= 1; i--) { for (int k = i; k >= 1; k--) { System.out.print(temp + " "); } temp++; System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 7 7 7 8 8 9 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int k = i; k >= 1; k--) { System.out.print(k + " "); } for (int l = 2; l ≤ i; l++) { System.out.print(l + " "); } System.out.println(); } for (int i = rows - 1; i >= 1; i--) { for (int k = i; k >= 1; k--) { System.out.print(k + " "); } for (int l = 2; l ≤ i; l++) { System.out.print(l + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 3 2 1 2 3 2 1 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = rows; j > i; j--) { System.out.print(" "); } int val1 = 1; for (int k = 1; k ≤ i; k++) { System.out.print(val1 + " "); val1 = val1 * 2; } val1 = val1 / 4; for (int l = i - 1; l >= 1; l--) { System.out.print(val1 + " "); val1 = val1 / 2; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 2 1 1 2 4 2 1 1 2 4 8 4 2 1 1 2 4 8 16 8 4 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = rows; i >= 1; i--) { for (int j = i; j ≤ rows; j++) { System.out.print(j + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 2; for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { while (!isPrime(temp)) { temp++; } System.out.print(temp + " "); temp++; } System.out.println(); } } public static boolean isPrime(int num) { boolean flag = false; for (int k = 2; k ≤ num / 2; k++) { if (num % k == 0) { flag = true; break; } } if (flag) { return false; } return true; } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); System.out.println("0"); for (int i = rows; i >= 1; i--) { for (int j = i; j ≤ rows; j++) { System.out.print(j); } System.out.print("0"); for (int k = rows; k >= i; k--) { System.out.print(k); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 0 505 45054 3450543 234505432 12345054321 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 1; for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print(temp + " "); temp++; } int temp1 = temp - 1; for (int k = 2; k ≤ i; k++) { System.out.print(--temp1 + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 2 4 5 6 5 4 7 8 9 10 9 8 7 11 12 13 14 15 14 13 12 11 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 1; for (int i = 1; i ≤ rows; i++) { for (int l = rows; l > i; l--) { System.out.print(" "); } for (int j = 1; j ≤ i; j++) { System.out.print(temp + " "); temp++; } int temp1 = temp - 1; for (int k = 2; k ≤ i; k++) { System.out.print(--temp1 + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 2 4 5 6 5 4 7 8 9 10 9 8 7 11 12 13 14 15 14 13 12 11 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); int temp = 1; System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int l = rows; l > i; l--) { System.out.print(" "); } for (int j = 1; j ≤ (i * 2 - 1); j++) { System.out.print((int) Math.pow(temp, 2) + " "); temp++; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); int temp = 1; for (int i = 1; i ≤ rows; i++) { for (int l = rows; l > i; l--) { System.out.print(" "); } for (int j = 1; j ≤ i; j++) { if (temp < 10) { System.out.print(temp + " "); temp++; } else { temp = 0; System.out.print(temp + " "); temp++; } } int temp1 = temp - 1; for (int k = 2; k ≤ i; k++) { if (temp1 == 0) { temp1 = 10; System.out.print(--temp1 + " "); } else { System.out.print(--temp1 + " "); } } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 2 3 2 4 5 6 5 4 7 8 9 0 9 8 7 1 2 3 4 5 4 3 2 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { int counter = 1; int currentRow = 1; Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int l = rows; l > i; l--) { System.out.print(" "); } if (i % 2 == 0) { int reverse = currentRow + counter - 1; for (int j = 0; j < i; j++) { System.out.print(reverse-- + " "); counter++; } } else { for (int j = 1; j ≤ i; j++) { System.out.print(counter + " "); counter++; } } System.out.println(); currentRow++; } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 3 2 4 5 6 10 9 8 7 11 12 13 14 15 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 1; i ≤ rows; i++) { for (int j = 1; j ≤ i; j++) { System.out.print((int) Math.pow(j, i) + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 4 1 8 27 1 16 81 256 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i < rows; i++) { int num = 1; for (int j = 0; j ≤ i; j++) { if(i ==0 || j ==0) { num = 1; } else { num = num * (i - j + 1)/ j; } System.out.print(num + " "); } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 |
Number Pattern Ippattelupackage com.jaladhi;import java.util.Scanner; public class Ippattelu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter The Number of Rows To Print The Pattern : "); int rows = scanner.nextInt(); System.out.println(" Printing the Pattern : "); for (int i = 0; i ≤ rows; i++) { int x = 0; int y = 1; System.out.print(y+" "); for (int j = 0; j < i; j++) { int z = x + y; System.out.print(z + " "); x = y; y = z; } System.out.println(); } } } |
Output :Enter The Number of Rows To Print The Pattern : 5Printing The Pattern : 1 1 1 1 1 2 1 1 2 3 1 1 2 3 5 1 1 2 3 5 8 |