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