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 Lists
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine()
- .Split(' ')
- .Select(el => int.Parse(el))
- .ToArray();
- int min = numbers[0];
- int max = numbers[0];
- int sum = 0;
- foreach (int item in numbers)
- {
- sum += item;
- if (item < min)
- {
- min = item;
- }
- if (item > max)
- {
- max = item;
- }
- }
- double avg = (double)sum / numbers.Length;
- Console.WriteLine($"Min = {min}");
- Console.WriteLine($"Max = {max}");
- Console.WriteLine($"Sum = {sum}");
- Console.WriteLine($"Average = {avg:F1}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement