Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace CrockedDigits2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- do
- {
- var result = (input.ToList().Where(x => Char.IsDigit(x)).ToList().Sum(x => x - 48).ToString());
- input = result;
- } while (input.Length > 1);
- Console.WriteLine(input);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement