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 _11OddEvenPosition
- {
- class OddEvenPosition
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double[] array = new double[n];
- double oddSum = 0.0;
- double oddMin = 0.0;
- double oddMax = 0.0;
- double evenSum = 0.0;
- double evenMin = 0.0;
- double evenMax = 0.0;
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = double.Parse(Console.ReadLine());
- if (i % 2 == 0)
- {
- oddSum = array.Sum();
- oddMin = array.Min();
- oddMax = array.Max();
- }
- if (i % 2 != 0)
- {
- evenSum = array.Sum();
- evenMin = array.Min();
- evenMax = array.Max();
- }
- }
- 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
Advertisement