[BOJ] 1110. 더하기 사이클 [구현] - c++

ha·2022년 2월 8일
0

BOJ

목록 보기
19/28
#include <stdio.h>

int main(void) {
	int N, n;
	int first, second,third;
	int count = 0;
	scanf("%d", &N);
	n = N; 
	while(1)
	{
	first = n / 10;
	second = n % 10;
	third = (first + second) % 10;
	n = second * 10 + third;
	count++;
	if (n == N) break;
	}
	printf("%d", count);
	
}

0개의 댓글