프로그래밍/BOJ
백준 알고리즘 [1110번] (C++) 더하기 사이클
coty
2019. 7. 29. 03:03
Code
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int N, newN, count = 0, sum;
int f, l;
cin >> N;
int org = N;
while (1) {
f = N / 10;
l = N % 10;
sum = (f + l) % 10;
N = (l * 10) + sum;
count++;
if (N == org)
break;
}
cout << count;
}