C# has a built-in Math class that provides useful mathematical functions and operations. The class has the IEEERemainder() function, which is used to compute the remainder resulting from the division of two specified numbers.
public static double IEEERemainder (double param1, double param2);
param1: This is a double number that specifies the dividend.param2: This is a double number that specifies the divisor.remainder = dividend - divisor*Quotient
where Quotient = Math.Round(dividend/divisor)
Double number specifying the remainder.remainder = 0, this returns:
+0 if dividend > 0-0 if dividend < 0NaN if divisor = 0.
Quotientis rounded to the nearest integer. It returns an even integer if halfway between two integers.
using System;class Educative{static void Main(){double result = Math.IEEERemainder(3, 2);System.Console.WriteLine("IEEERemainder(3, 2) = "+ result);double result1 = Math.IEEERemainder(3, 3);System.Console.WriteLine("IEEERemainder(3, 3) = "+ result1);double result2 = Math.IEEERemainder(3, 0);System.Console.WriteLine("IEEERemainder(3, 0) = "+ result2);}}