Lyo001 / gg

0 stars 0 forks source link

Pattern #3

Open Lyo001 opened 1 month ago

Lyo001 commented 1 month ago

public class PatternA { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternB { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = i; j <= n; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternC { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j < i; j++) { System.out.print(" "); } for (int j = i; j <= n; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternD { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternE { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == 1 || i == n || j == 1 || j == n) { System.out.print("# "); } else { System.out.print(" "); } } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternF { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == 1 || i == n || i == j || j == n - i + 1) { System.out.print("# "); } else { System.out.print(" "); } } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternG { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i == 1 || i == n || j == 1 || j == n || i == j || j == n - i + 1) { System.out.print("# "); } else { System.out.print(" "); } } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternH { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } for (int i = n - 1; i >= 1; i--) { for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternI { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } for (int i = n - 1; i >= 1; i--) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternJ { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternK { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternL { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print("# "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternM { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternN { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i + 1; j++) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternO { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i + 1; j++) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternP { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i + 1; j++) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternQ { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternR { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print(j + " "); } for (int j = i - 1; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternS { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print(j + " "); } for (int j = i - 1; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternT { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= i; j++) { System.out.print(j + " "); } for (int j = i - 1; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } }

Lyo001 commented 1 month ago

public class PatternU { public static void main(String[] args) { int n = 8; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { System.out.print(" "); } for (int j = 1; j <= i; j++) { System.out.print(j + " "); } for (int j = i - 1; j >= 1; j--) { System.out.print(j + " "); } System.out.println(); } } }