Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace EqualSum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
- bool isFound = false;
- for (int i = 0; i < arr.Length; i++)
- {
- int rightSum = 0;
- for (int r = i + 1; r < arr.Length; r++)
- {
- rightSum += arr[r];
- }
- int leftSum = 0;
- for (int l = i - 1; l >= 0; l--)
- {
- leftSum += arr[l];
- }
- if (rightSum == leftSum)
- {
- Console.WriteLine(i);
- isFound = true;
- break;
- }
- }
- if (!isFound)
- {
- Console.WriteLine("no");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement