Search

반복문2_문제09_일의자리

대분류
STEP03 반복문
소분류
반복문2_문제

영상

문제

package 반복문2_문제; /* [문제] 9의 배수 중 일의 자리가 6인 첫번째 배수를 구하시오. [정답] 36 */ public class 반복문2_문제09_일의자리_문제 { public static void main(String[] args) { } }
Java
복사

해설

package 반복문2_문제; /* [문제] 9의 배수 중 일의 자리가 6인 첫번째 배수를 구하시오. [정답] 36 */ public class 반복문2_문제09_일의자리_정답 { public static void main(String[] args) { int i = 1; boolean run = true; while(run) { int unit = i % 10; if(i % 9 == 0 && unit == 6) { System.out.println(i); run = false; } i += 1; } } }
Java
복사