Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int n = Int32.Parse(Console.ReadLine());
- int[] arr = new int[n];
- int sum = 0;
- for (int i = 0; i < n; i++)
- {
- int num = Int32.Parse(Console.ReadLine());
- arr[i] = num;
- sum += num;
- }
- double avrg = (sum * 1.0) / n;
- double avrgSum = avrg;
- if (n > 1)
- {
- avrgSum += ((arr[1] + arr[n - 2]) * 1.0) / 2;
- }
- Console.WriteLine(avrg);
- Console.WriteLine(avrgSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement