
출제 링크 : https://www.acmicpc.net/problem/1110
1110번: 더하기 사이클
0보다 크거나 같고, 99보다 작거나 같은 정수가 주어질 때 다음과 같은 연산을 할 수 있다. 먼저 주어진 수가 10보다 작다면 앞에 0을 붙여 두 자리 수로 만들고, 각 자리의 숫자를 더한다. 그 다음,
www.acmicpc.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Solution
{
class Program
{
static void Main(string[] args)
{
int First_Number = int.Parse(Console.ReadLine());
int Last_Number = First_Number;
int Cycle = 0;
bool repeat = true;
while(repeat)
{
int Tens = Last_Number / 10;
int Units = Last_Number % 10;
int Sum = Tens + Units;
int Result = Sum % 10;
Last_Number = (Units * 10) + Result;
Cycle++;
if (First_Number == Last_Number) break;
}
Console.WriteLine(Cycle);
}
}
}
