[JAVA]24.사각형 모양 출력하기(중첩 반복문)

손영민's avatar
Feb 16, 2025
[JAVA]24.사각형 모양 출력하기(중첩 반복문)
package ex03; public class NestedLoop { public static void main(String[] args) { for (int y = 0; y < 5; y++) { for (int x = 0; x < 10; x++) { System.out.print("*"); } System.out.println(""); } } }
 
package ex03; public class NestedLoop { public static void main(String[] args) { int y = 0; while (y < 5) { int x = 0; y++; while (x < 10) { x++; System.out.print("*"); } System.out.println(""); } } }
Share article

sson17