- 구구단 5단 출력하기
- 데이터: dan(5단), i(1~9), 곱하기는 반복되는 명령문이다.
package com.dream.controls;
public class ForEx05 {
public static void main(String[] args) {
int dan = 7;
int result = 0;
for(int i=1; i<=9; i++) {
result = dan * i; //곱하기를 반복
System.out.println(dan + " x " + i + " = " + result); //출력을 반복
}
}
}