C# Decimal Remainder
Description
Decimal Remainder
computes the remainder after dividing
two Decimal values.
Syntax
Decimal.Remainder
has the following syntax.
public static decimal Remainder(
decimal d1,
decimal d2
)
Parameters
Decimal.Remainder
has the following parameters.
d1
- The dividend.d2
- The divisor.
Returns
Decimal.Remainder
method returns The remainder after dividing d1 by d2.
Example
The following example uses the Remainder method to calculate the remainder in a series of division operations.
using System;/*w ww . j a va 2s . com*/
public class Example
{
public static void Main()
{
Decimal dividend = 3M;
Decimal divisor = 2M;
Console.WriteLine(Decimal.Remainder(dividend, divisor));
}
}
The code above generates the following result.