MathF.Max() Method in C# with Examples
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:
// C# program to demonstrate the // MathF.Max(Single, Single) method using System; class GFG { // Main Method static void Main() { // taking different float values float f1 = 34.56f, f2 = 37.3412f; float f3 = -675.2f, f4 = -56.47f; // displaying result Console.WriteLine(MathF.Max(f1, f2)); Console.WriteLine(MathF.Max(f3, f4)); } } |
37.3412 -56.47
Recommended Posts:
- MathF.Abs() Method in C# with Examples
- MathF.Min() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- MathF.Sin() Method in C# with Examples
- MathF.Log() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- String.Split() Method in C# with Examples
- BitArray.LeftShift() Method in C# with Examples
- MathF.Atan() Method in C# with Examples
- MathF.Cbrt() Method in C# with Examples
- Double.CompareTo Method in C# with Examples
- Graphics.Clear() Method in C# with Examples
- Double.Equals() Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



