Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MinMaxSumAndAvarageOfN
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int max = int.MinValue;
- int min = int.MaxValue;
- double sum = 0;
- double avg = 0;
- for (int i = 0; i < n; i++)
- {
- int x = int.Parse(Console.ReadLine());
- if (x > max)
- {
- max = x;
- }
- if (x < min)
- {
- min = x;
- }
- sum += x;
- }
- avg = sum / n;
- Console.WriteLine("Min is {0}", min);
- Console.WriteLine("Max is {0}", max);
- Console.WriteLine("Sum is {0}", sum);
- Console.WriteLine("Avg is {0:0.00}", avg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement