Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace SumOfElementsSequence
- {
- class Program
- {
- static void Main()
- {
- string inputLine = Console.ReadLine();
- string[] numbers = inputLine.Split(' ');
- double sum = 0;
- for (int i = 0; i < numbers.Length; i++)
- {
- int number = int.Parse(numbers[i]);
- }
- int[] myInts = numbers.Select(int.Parse).ToArray();
- int maxValue = myInts.Max();
- sum = myInts.Sum();
- Array.Sort(myInts);
- if (maxValue == (sum - maxValue))
- {
- Console.WriteLine("Yes, sum={0}",maxValue);
- }
- else
- {
- Console.WriteLine("No, diff={0}",Math.Abs(maxValue-(sum-maxValue)));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement