- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MathF.Min() Method in C# with Examples
The MathF.Min() method in C# returns the smallest of the two specified numbers.
Syntax
Following is the syntax −
public static float Min (float val1, float val2);
Above, val1 is the first number, whereas val2 is the second number. Both of these numbers are compared.
Example
Let us now see an example to implement the MathF.Min() method −
using System; public class Demo { public static void Main(){ float val1 = 6.89f; float val2 = 4.45f; Console.WriteLine("Minimum Value = "+MathF.Min(val1, val2)); } }
Output
This will produce the following output −
Minimum Value = 4.45
Example
Let us now see another example to implement the MathF.Min() method −
using System; public class Demo { public static void Main(){ float val1 = 1.00f; float val2 = 0.11f; Console.WriteLine("Minimum Value = "+MathF.Min(val1, val2)); } }
Output
This will produce the following output −
Minimum Value = 0.11
Advertisements