How to find the Minimum of Three Numbers in C# - Step by Step Examples
How to find the Minimum of Three Numbers in C# ?
Answer
To find the minimum of three numbers in C#, you can use the `Math.Min` method.
✐ Examples
1 Find Minimum of Three Numbers
In this example,
- We declare three variables
a
,b
, andc
with the numbers to compare. - We use the `Math.Min` method to compare the numbers and get the minimum.
C# Program
using System;
class Program
{
static void Main()
{
int a = 5;
int b = 8;
int c = 3;
int min = Math.Min(Math.Min(a, b), c);
Console.WriteLine("Minimum of three numbers is: " + min);
}
}
Output
Minimum of three numbers is: 3
Summary
In this tutorial, we learned How to find the Minimum of Three Numbers in C# language with well detailed examples.