Advertisement
Guest User

Untitled

a guest
Apr 9th, 2016
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _11OddEvenPosition
  8. {
  9. class OddEvenPosition
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. double[] array = new double[n];
  15. double oddSum = 0.0;
  16. double oddMin = 0.0;
  17. double oddMax = 0.0;
  18. double evenSum = 0.0;
  19. double evenMin = 0.0;
  20. double evenMax = 0.0;
  21. for (int i = 0; i < array.Length; i++)
  22. {
  23. array[i] = double.Parse(Console.ReadLine());
  24. if (i % 2 == 0)
  25. {
  26. oddSum = array.Sum();
  27. oddMin = array.Min();
  28. oddMax = array.Max();
  29. }
  30. if (i % 2 != 0)
  31. {
  32. evenSum = array.Sum();
  33. evenMin = array.Min();
  34. evenMax = array.Max();
  35. }
  36. }
  37. Console.WriteLine("OddSum = {0}", oddSum);
  38. Console.WriteLine("OddMin = {0}", oddMin);
  39. Console.WriteLine("OddMax = {0}", oddMax);
  40. Console.WriteLine("EvenSum = {0}", evenSum);
  41. Console.WriteLine("EvenMin = {0}", evenMin);
  42. Console.WriteLine("EvenMax = {0}", evenMax);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement