Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace From_Left_to_the_Right
- {
- class Program
- {
- static void Main(string[] args)
- {
- int input = int.Parse(Console.ReadLine());
- int sumOfLeftNumber = 0;
- int sumOfRightNumber = 0;
- int sum = 0;
- for (int i = 0; i <= input; i++)
- {
- int leftNumber = Convert.ToInt32(Console.ReadLine());
- int rightNumber = Convert.ToInt32(Console.ReadLine());
- if (leftNumber > rightNumber)
- {
- while (leftNumber > 0)
- {
- int lastDigit = leftNumber % 10;
- sum += lastDigit;
- leftNumber /= 10;
- }
- }
- else
- {
- while (rightNumber > 0)
- {
- int lastDigit = rightNumber % 10;
- sum += lastDigit;
- rightNumber /= 10;
- }
- }
- Console.WriteLine(sum);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement