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 ConsoleApplication88
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- double EvenSum = 0;
- double OddSum = 0;
- double EvenMax = double.MinValue;
- double EvenMin = double.MaxValue;
- double OddMax = double.MinValue;
- double OddMin = double.MaxValue;
- if (n == 0)
- {
- Console.WriteLine("OddSum = " + 0);
- Console.WriteLine("OddMin = No");
- Console.WriteLine("OddMax = No");
- Console.WriteLine("EvenSum = " + 0);
- Console.WriteLine("EvenMin = No");
- Console.WriteLine("EvenMax = No");
- }
- else if (n > 0)
- {
- for (int i = 1; i <= n; i++)
- {
- var num = double.Parse(Console.ReadLine());
- if (n == 1)
- {
- Console.WriteLine("OddSum = {0}", num);
- Console.WriteLine("OddMin = {0}", num);
- Console.WriteLine("OddMax = {0}", num);
- Console.WriteLine("EvenSum = " + 0);
- Console.WriteLine("EvenMin = No");
- Console.WriteLine("EvenMax = No");
- }
- if (i % 2 != 0)
- {
- OddSum += num;
- if (num > OddMax)
- {
- OddMax = num;
- }
- if (num < OddMin)
- {
- OddMin = num;
- }
- }
- else
- {
- EvenSum += num;
- if (num > EvenMax)
- {
- EvenMax = num;
- }
- if (num < EvenMin)
- {
- EvenMin = num;
- }
- }
- }
- if (n > 1)
- {
- Console.WriteLine("OddSum={0}", OddSum);
- Console.WriteLine("OddMin={0}", OddMin);
- Console.WriteLine("OddMax={0}", OddMax);
- Console.WriteLine("EvenSum={0}", EvenSum);
- Console.WriteLine("EvenMin={0}", EvenMin);
- Console.WriteLine("EvenMax={0}", EvenMax);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment