Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class MinMaxAverageSumOfNumbers
- {
- // CONDITION:
- // Write a program that reads from the console a sequence of n integer numbers and returns the minimal, the maximal number, the sum and the average of all numbers (displayed with 2 digits after the decimal point). The input starts by the number n (alone in a line) followed by n lines, each holding an integer number.
- static void Main()
- {
- Console.Write("Enter N numbers:");
- int n = int.Parse(Console.ReadLine());
- double[] numArr = new double[n];
- double[] secondArr = numArr;
- for (int i = 0; i < n; i++)
- {
- Console.Write("{0}.integer: ",i);
- numArr[i] = double.Parse(Console.ReadLine());
- }
- Console.WriteLine(numArr.Min());
- Console.WriteLine(numArr.Max());
- Console.WriteLine(secondArr.Sum());
- Console.WriteLine("{0:F2}",numArr.Average());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement