Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> list = new List<int> { 3, 4, 5, 6 };
- Console.WriteLine(Min(list));
- }
- public static int Min( List<int> list)
- {
- int min = int.MaxValue;
- foreach (int number in list)
- {
- if(number < min)
- {
- min = number;
- }
- }
- return min;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment