1.
package ch02;
import java.util.Scanner;
public class While301 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.println("정수 2개를 입력하세요:");
int x, y, Garo, Sero;
x = in.nextInt();
y = in.nextInt();
Garo = 1;
Sero = 1;
while (Garo <= x) {
while (Sero <= y) {
System.out.printf("%4d", Garo * Sero);
Sero++;
}
Sero = 1;
Garo++;
System.out.println();
}
}
}
2.
package ch02;
import java.util.Scanner;
public class While3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
System.out.printf("정수 2개를 입력하세요:");
int x = 10;// in.nextInt();10
int y = 10;// in.nextInt();10
int a = 1;
int b = 1;
int c = 1;
while (a <= x) {
while (b <= y) {
System.out.print(a * b + " ");
b = b + 1;
}
System.out.println("");
a = a + 1;
b = c;
}
}
}!