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 countOfRows = int.Parse(Console.ReadLine());
- for (int i = 1; i <= countOfRows; i++)
- {
- string currentRow = Console.ReadLine();
- string[] currentNumbers = currentRow.Split(" ");
- long leftNumber = long.Parse(currentNumbers[0]);
- long rightNumber = long.Parse(currentNumbers[1]);
- long leftSum = 0;
- long rightSum = 0;
- if (leftNumber > rightNumber)
- {
- while (leftNumber != 0)
- {
- leftSum += (int)(leftNumber % 10);
- leftNumber /= 10;
- }
- Console.WriteLine(Math.Abs(leftSum));
- }
- else
- {
- while (rightNumber != 0)
- {
- rightSum += (int)(rightNumber % 10);
- rightNumber /= 10;
- }
- Console.WriteLine(Math.Abs(rightSum));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment