06 / 07 과제 내 가 작성 한 코드 : class Hw 0607 { public static void main ( String [ ] args ) { int dan , i , j ; for ( dan = 1 ; dan <= 9 ; dan ++) { if ( dan % 3 == 0 ) { System . out . printf ( "==% d 단 ==\ n ", dan ) ; for ( i = 2 ; i <= 9 ; i ++) { for ( j = dan - 2 ; j <= dan ; j ++){ int result = i * j ; if ( j % 3 == 0 ) System . out . printf ( "% d *% d =% d \ n ", j , i , result ) ; else System . out . printf ( "% d *% d =% d \ t ", j , i , result ) ;}} System . out . println ( ) ;} else System . out . printf ( "==% d 단 ==\ t ", dan ) ;}}} 강사 님 예시 : class GuGuDan { public static void main ( String [ ] args ) { System . out . println ( "\ t 구구단 "); for ( int dan = 1 ; dan <= 9 ; dan += 3 ) { / / dan = 1 , 4 , 7 / / 단 타이틀 for ( int i = dan ; i < dan + 3 ; i ++) { / / dan = 1 123 / 4 456 / 7 789 System . out . print ( "=="+ i +" 단 ==\ t ");} System . out . println ( ) ;// 3 단 출력 for ( int k = 2 ; k <= 9 ; k ++) { / / 234567897 trfor ( int z = dan ; z < dan + 3 ; z ++) { / / dan = 1 z = 123 / dan = 4 z = 456 . .. int r = z * k ; System . out . print ( z +"*"+ k +"="+ r +"\ t ");} System . out . println ( ) ;}}}}