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 Odd___Even_Position_11
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- double oddSum = 0;
- double oddMin = double.MinValue;
- double oddMax = double.MaxValue;
- double evenSum = 0;
- double evenMin = -1000000000.0;
- double evenMax = 1000000000.0;
- double oddMin1 = oddMin;
- double oddMax1 = oddMax;
- double evenMin2 = evenMin;
- double evenMax2 = evenMax;
- if (n != 0)
- {
- for (int i = 1; i <= 2; i++)
- {
- var num12 = double.Parse(Console.ReadLine());
- if (i == 1)
- {
- oddSum = num12;
- oddMin = num12;
- oddMax = num12;
- }
- else
- {
- evenSum = num12;
- evenMin = num12;
- evenMax = num12;
- }
- if (n == 1) break;
- }
- if (n > 2)
- {
- for (int i = 3; i <= n; i++)
- {
- var num3 = double.Parse(Console.ReadLine());
- if (i % 2 == 0)
- {
- evenSum += num3;
- if (num3 < evenMin) evenMin = num3;
- if (num3 > evenMax) evenMax = num3;
- }
- else
- {
- oddSum += num3;
- if (num3 < oddMin) oddMin = num3;
- if (num3 > oddMax) oddMax = num3;
- }
- }
- }
- }
- Console.WriteLine($"OddSum={oddSum}");
- if (oddMin == oddMin1) Console.WriteLine($"OddMin=No");
- else Console.WriteLine($"OddMin={oddMin}");
- if (oddMax == oddMax1) Console.WriteLine($"OddMax=No");
- else Console.WriteLine($"OddMax={oddMax}");
- Console.WriteLine($"EvenSum={evenSum}");
- if (evenMin == evenMin2) Console.WriteLine($"EvenMin=No");
- else Console.WriteLine($"EvenMin={evenMin}");
- if (evenMax == evenMax2) Console.WriteLine($"EvenMax=No");
- else Console.WriteLine($"EvenMax={evenMax}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement