Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _10.OddEvenSum
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int numOfRowsS = int.Parse(Console.ReadLine());
- int evenSumS = 0;
- int oddSumS = 0;
- for (int value = 1; value <= numOfRowsS; value++)
- {
- int curNumber = int.Parse(Console.ReadLine());
- if (value % 2 == 0)
- {
- evenSumS += curNumber;
- }
- else
- {
- oddSumS += curNumber;
- }
- }
- if (evenSumS == oddSumS)
- {
- Console.WriteLine($"Yes\r\nSum = {evenSumS}");
- }
- else
- {
- Console.WriteLine($"No\r\nDiff = {Math.Abs(evenSumS - oddSumS)}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement