Math.IEEERemainder returns the remainder resulting from the division
using System; public class Example { public static void Main() { ShowRemainders(3, 2); } private static void ShowRemainders(double number1, double number2) { string formula = String.Format("{0} / {1} = ", number1, number2); Console.WriteLine("{0,-16} {1,18} {2,20}", formula, Math.IEEERemainder(number1, number2), number1 % number2); } }