분류 전체보기 75

1110 : 더하기 사이클

import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); // 입력된 숫자 int a = 0; // 일의자리수 int b = 0; // 십의자리수 int cnt = 0; // 사이클 카운트 int tmp = 0; // 원래 숫자비교 tmp = num; while (true) { if (tmp >= 0) { a = tmp % 10 + tmp / 10; if (a >= 10) a = a % 10; b = tmp % 10 * 10; tmp = a + b; ++cnt; if (..

일상 2021.07.26