Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace SimpleLoops
- {
- class Program
- {
- static void Main()
- {
- #if DEBUG
- Console.SetIn(new System.IO.StreamReader(@"E:\My Documents\Downloads\SoftUni\Input.txt"));
- #endif
- var n = int.Parse(Console.ReadLine());
- List<double> oddList = new List<double>();
- List<double> evenList = new List<double>();
- for (int i = 0; i < n; i++)
- {
- var input = double.Parse(Console.ReadLine());
- if (i%2 == 0) oddList.Add(input);
- else evenList.Add(input);
- }
- if (oddList.Count() == 0)
- {
- Console.WriteLine("OddSum = {0}", 0);
- Console.WriteLine("OddMin = No");
- Console.WriteLine("OddMax = No");
- }
- else
- {
- Console.WriteLine($"OddSum = {oddList.Sum()}");
- Console.WriteLine($"OddMin = {oddList.Min()}");
- Console.WriteLine($"OddMax = {oddList.Max()}");
- }
- if (evenList.Count() == 0)
- {
- Console.WriteLine("EvenSum = {0}", 0);
- Console.WriteLine("EvenMin = No");
- Console.WriteLine("EvenMax = No");
- }
- else
- {
- Console.WriteLine($"EvenSum = {evenList.Sum()}");
- Console.WriteLine($"EvenMin = {evenList.Min()}");
- Console.WriteLine($"EvenMax = {evenList.Max()}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement