Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace CrockedDigits2
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10.  
  11. string input = Console.ReadLine();
  12.  
  13. do
  14. {
  15. var result = (input.ToList().Where(x => Char.IsDigit(x)).ToList().Sum(x => x - 48).ToString());
  16. input = result;
  17.  
  18. } while (input.Length > 1);
  19.  
  20. Console.WriteLine(input);
  21.  
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement