본문 바로가기
알고리즘 문제연습/기초 알고리즘

[015] 구구단 출력하기

by 은z 2021. 5. 29.

문제

- s단 ~ f단까지 구구단을 출력하세요

- 중첩반복문 이용

 

보완할 점

 

소스코드

public class Algotithm15 {

	public static void main(String[] args) {
		int snum = 2;
		int fnum = 5;
		
		for(int j = 1; j < 10; j++) {
			for(int i = snum; i <= fnum; i++ ) {
					System.out.print(i + " * " + j + " = " + (i*j) +"\t");
			}
			System.out.println();
		
		}
	}
}

댓글