MathF.Max() Method in C# with Examples
Last Updated :
04 Apr, 2019
In C#, Max(Single, Single) is a MathF class method which is used to returns the larger of the two specified numbers.
Syntax: public static float Max (float x, float y);
Here, x and y are the two floating point numbers which are compared.
Return Type: This method returns the maximum of the two numbers which specified into the parameter list and return type depends on the type of arguments passed.
Example:
using System;
class GFG {
static void Main()
{
float f1 = 34.56f, f2 = 37.3412f;
float f3 = -675.2f, f4 = -56.47f;
Console.WriteLine(MathF.Max(f1, f2));
Console.WriteLine(MathF.Max(f3, f4));
}
}
|
Share your thoughts in the comments
Please Login to comment...