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 Project_1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n, sum = 0, difference = 0;
- Console.WriteLine("Enter size of array");
- n = int.Parse(Console.ReadLine());
- int[] array = new int[n];
- Console.WriteLine("Please enter {0} numbers.", array.Length);
- for(int i = 0; i < array.Length; i++)
- {
- array[i] = int.Parse(Console.ReadLine());
- }
- for (int i = 0; i < array.Length; i++) {
- sum += array[i];
- }
- //ascending difference
- for (int i = 0; i < array.Length; i++)
- {
- difference -= array[i];
- }
- Console.WriteLine("Sum = {0}\nDifference = {1}\nAverage = {2}\nMax = {3}\nMin = {4}", sum, difference, sum/array.Length, array.Max(), array.Min());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement