Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace AlgorithmsOverStructureData
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- List<int> numbers = input.Split(" ").Select(int.Parse).ToList();
- //2 4 1 6 7
- int min = int.MaxValue; //numbers[0]
- int max = int.MinValue;
- foreach(int number in numbers)
- {
- if(number < min)
- {
- min = number;
- }
- if(number > max)
- {
- max = number;
- }
- }
- Console.WriteLine("Min: " + min);
- Console.WriteLine("Max: " + max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement