Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication17
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = int.Parse(Console.ReadLine());
- int sumDigitEven = 0;
- int sumDigitOdd = 0;
- for (int count = 1; count <= input; count++)
- {
- var digit = int.Parse(Console.ReadLine());
- {
- if (count % 2 == 0)
- {
- sumDigitEven += digit;
- }
- else
- {
- sumDigitOdd += digit;
- }
- }
- }
- if (sumDigitEven == sumDigitOdd)
- {
- Console.WriteLine("Yes Sum = {0}", sumDigitEven);
- }
- else
- {
- Console.WriteLine("No Diff = {0}", Math.Abs(sumDigitEven - sumDigitOdd));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement