C# Math Max(Int32, Int32)
Description
Math Max(Int32, Int32)
returns the larger of two 32-bit
signed integers.
Syntax
Math.Max(Int32, Int32)
has the following syntax.
public static int Max(
int val1,
int val2
)
Parameters
Math.Max(Int32, Int32)
has the following parameters.
val1
- The first of two 32-bit signed integers to compare.val2
- The second of two 32-bit signed integers to compare.
Returns
Math.Max(Int32, Int32)
method returns Parameter val1 or val2, whichever is larger.
Example
The following example demonstrates how to use the Max method to return and display the greater of two variables.
using System;//from www. ja va 2s . c o m
class Sample
{
public static void Main()
{
int xInt1 = -3, xInt2 = 53;
Console.WriteLine(Math.Max(xInt1, xInt2));
}
}
The code above generates the following result.