N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다.
출력형식과 같게 N1부터 N9까지 출력한다.
for문을 i = 1부터 9와 같을 때까지 돌려 num, i, num * i를 반복해서 출력해주면 된다.
import java.util.Scanner;
public class bj_2739 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
for(int i = 1; i <= 9; i++) {
System.out.println(num + " " + "*" + " "+ i + " " + "=" + " " + (num * i));
}
}
}