Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace CrockedDigits2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string n = Console.ReadLine();
- int result = 0;
- do
- {
- result = 0;
- foreach (char item in n)
- {
- if (Char.IsDigit(item))
- {
- result += (int)Char.GetNumericValue(item);
- }
- }
- n = result.ToString();
- } while (n.Length > 1);
- Console.WriteLine(result);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement