Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Numerics;
- namespace ConsoleApp18
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numbers = int.Parse(Console.ReadLine());
- for (int i = 0; i < numbers; i++)
- {
- int sum = 0;
- double numMax = 0;
- double[] arr = Console.ReadLine().Split(" ").Select(double.Parse).ToArray();
- double numLeft = arr[0];
- double numRight = arr[1];
- numMax = numLeft;
- if (numLeft < numRight)
- {
- numMax = numRight;
- }
- string maxNumberAbs = Math.Abs(numMax).ToString();
- for (int x = 0; x < maxNumberAbs.Length; x++)
- {
- char digit = maxNumberAbs[x];
- sum = sum + int.Parse(digit.ToString());
- }
- Console.WriteLine(sum);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement