algorithm

while 구구단 Java[자바]

달마루 2023. 2. 6. 18:31

while로 구현한 구구단

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