Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Numerics;
- namespace CroockedDigits
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string clearedInput = input.Replace(".", "").Replace("-" , "");
- BigInteger parseInput = long.Parse(clearedInput);
- BigInteger n = parseInput;
- BigInteger sum = 0;
- while (n > 0 || sum > 9)
- {
- if (n == 0)
- {
- n = sum;
- sum = 0;
- }
- sum += n % 10;
- n = n / 10;
- }
- Console.WriteLine(sum);
- //bie mi IR na nqkoi ot testovete
- //test s Biginteger
- //pak pishe IRA
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement