Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write a program that reads from the console a sequence of N integer numbers and returns the minimal and maximal of them.
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ex3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("numbers = ");
- int n = Int32.Parse(Console.ReadLine());
- List<int> newList = new List<int> { };
- for (int i = 0; i < n; i++)
- {
- Console.Write("number {0} = ",i+1);
- int g = int.Parse(Console.ReadLine());
- newList.Add(g);
- }
- Console.WriteLine("Max value : {0}",newList.Max());
- Console.WriteLine("Min value : {0}", newList.Min());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment