Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Numerics;
- using System.Linq;
- using System;
- namespace CroockedDIgits
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<decimal> n = Console.ReadLine().Split('.').Select(decimal.Parse).ToList();
- string digits = string.Join("", n);
- Int64 number = Math.Abs(Int64.Parse(digits));
- Int64 sum = 0;
- while (number != 0)
- {
- sum += number % 10;
- number /= 10;
- if (sum > 9)
- {
- sum = sum - 9;
- continue;
- }
- }
- Console.WriteLine(sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement