Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Telerik
- {
- public class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().ToCharArray() ;
- while (input.Length > 1)
- {
- int result = 0;
- for (int i = 0; i < input.Length; i++)
- {
- if (char.IsDigit(input[i]))
- {
- result += input[i] - 48;
- }
- }
- input = result.ToString().ToCharArray();
- }
- Console.WriteLine(input) ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement