Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FromLeftToTheRight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int inputLines = int.Parse(Console.ReadLine());
- for (int i = 1; i <= inputLines; i++)
- {
- string currentString = Console.ReadLine();
- string[] array = currentString.Split(' ');
- long firstNumber = long.Parse(array[0]);
- long secondNumber = long.Parse(array[1]);
- long currentDigit = 0;
- long sumOfDigits = 0;
- if (firstNumber >= secondNumber)
- {
- while (firstNumber > 0)
- {
- currentDigit = firstNumber % 10;
- sumOfDigits += currentDigit;
- firstNumber = firstNumber / 10;
- }
- Console.WriteLine(sumOfDigits);
- }
- else if (secondNumber >= firstNumber)
- {
- while (secondNumber > 0)
- {
- currentDigit = secondNumber % 10;
- sumOfDigits += currentDigit;
- secondNumber = secondNumber / 10;
- }
- Console.WriteLine(sumOfDigits);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement