Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- int lines = int.Parse(Console.ReadLine());
- for (int i = 0; i < lines; i++)
- {
- string numbers = Console.ReadLine();
- int index = numbers.IndexOf(' ');
- long first = long.Parse(numbers.Substring(0, index));
- long second = long.Parse(numbers.Substring(index));
- long biggestNumber = first > second ? first : second;
- long sum = 0;
- while (biggestNumber != 0)
- {
- sum += biggestNumber % 10;
- biggestNumber /= 10;
- }
- Console.WriteLine(Math.Abs(sum));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment