How to use Math.Min() that return the smaller of two numbers in C#

2 Answers

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n1 = 13;
            int n2 = 7;

            int min = Math.Min(n1, n2);
            Console.WriteLine(min);
        }
    }
}


/*
run:

7

*/

 



answered Jan 3, 2017 by avibootz
0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n1 = -289;
            int n2 = 5;

            int min = Math.Min(n1, n2);
            Console.WriteLine(min);
        }
    }
}


/*
run:

-289

*/

 



answered Jan 3, 2017 by avibootz
...