using System; public class Test { public static void Main() { for (int i = -10 ; i <= 20 ; i++) { Console.WriteLine("{0} - {1}", i, Math.Min(Math.Max(i, -5), 15)); } } }
Standard input is empty
-10 - -5 -9 - -5 -8 - -5 -7 - -5 -6 - -5 -5 - -5 -4 - -4 -3 - -3 -2 - -2 -1 - -1 0 - 0 1 - 1 2 - 2 3 - 3 4 - 4 5 - 5 6 - 6 7 - 7 8 - 8 9 - 9 10 - 10 11 - 11 12 - 12 13 - 13 14 - 14 15 - 15 16 - 15 17 - 15 18 - 15 19 - 15 20 - 15