Open In App

MathF.Min() Method in C# with Examples

Improve
Improve
Like Article
Like
Save
Share
Report

In C#, Min(Single, Single) is a MathF class method which is used to returns the minimum of the two specified numbers.

Syntax: public static float Min (float x, float y);
Here, x and y are the two floating point numbers which are compared.

Return Type: This method returns the minimum of the two numbers which specified into the parameter list and return type depends on the type of arguments passed.

Example:




// C# program to demonstrate the
// MathF.Min(Single, Single) method
using System;
  
class GFG {
  
    // Main Method
    static void Main()
    {
        // taking different float values
        float f1 = 56.48f, f2 = 78.123457f;
        float f3 = -785.2f, f4 = -58.2547f;
  
        // displaying result
        Console.WriteLine(MathF.Min(f1, f2));
        Console.WriteLine(MathF.Min(f3, f4));
    }
}


Output:

56.48
-785.2

Last Updated : 04 Apr, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads