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 Min_Max_Sum_Average
- {
- class Program
- {
- static void Main(string[] args)
- {
- short n = short.Parse(Console.ReadLine());
- double min = double.MaxValue;
- double max = double.MinValue;
- double sum = 0;
- double avg = 0;
- for (int i = 0; i < n; i++)
- {
- double b = double.Parse(Console.ReadLine());
- if (b > max)
- {
- max = b;
- }
- if (b < min)
- {
- min = b;
- }
- sum += b;
- }
- avg = sum / n;
- Console.WriteLine("min={0:f2}",min);
- Console.WriteLine("max={0:f2}",max);
- Console.WriteLine("sum={0:f2}",sum);
- Console.WriteLine("avg={0:f2}",avg);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement