.NET Fiddle

CSharp · Console

/Program.cs

using System;

class Program
{
    static void Main()
    {
        //take input from console
        string first = Console.ReadLine();
        string[] splitted = first.Split(' ');//split them with empty spaces
        
        int[] Arr = new int[splitted.Length];//int array for string console values
        for (int i = 0; i < splitted.Length; i++)//goes true all elements and converts them into Int32
        {
            Arr[i] = int.Parse(splitted[i]);
        }
        //for (int i = 0; i < Arr.Length; i++)//print array to see what happened
        //{
        //    Console.WriteLine(Arr[i]);
        //}

        int[] novArr = new int[(Arr.Length / 2)];

        int sum = 0;

        for (int i = 0; i < Arr.Length; i += 2)
        {
            if (i + 1 < Arr.Length)
            {
                novArr[sum] = Arr[i] + Arr[i + 1];
            }
            else
            {
                novArr[sum] = Arr[i];
            }
            sum++;
        }

        //check if the values are equal
        int counter = 0;
        int value = 0;
        for (int i = 0; i < novArr.Length - 1; i++)
        {
            if (novArr[i] == novArr[i + 1])
            {
                counter++;
            }
            else
            {
                value = novArr[i] - novArr[i + 1];
            }
        }

        if (counter == novArr.Length - 1)
        {
            Console.WriteLine("Yes,value= {0}", novArr[0]);
        }
        else
        {
            Console.WriteLine("No,maxdiff= {0}", Math.Abs(value));
        }
    }
}
;