프로그래밍

JAVA 구구단

Dilrong 2013. 11. 11. 20:32
public class NineToNine {
 
public static void main(String[] args) {
 
int mt[][] = new int[9][9]; //구구단 표 저장 배열
 
int i,j; 

<!--[if !supportEmptyParas]--> <!--[endif]--> 
 
//구구단 배열에 저장 

for(i=0; i<9; i++){
 
for(j=0; j<9; j++)
 
{ 

mt[i][j] = (i+1) * (j+1);
 
} 

} 

//구구단 표 출력 

for(i=0; i<9; i++){
 
for(j=0; j<9; j++)
 
{ 

System.out.print((j+1) + "*" + (i+1) + "=" +mt[j][i] + "\t");
 
} 

System.out.println(); 

} 

} 

} 

반응형