C#C
C#4y ago
T3CH

Modulus division returning 1 less than it should [Answered]

public static int 
CPCalculatePennies(double change)
        {
            double pennies = change % 5 % 1 % 0.25 % 0.1 % 0.05 / 0.01;
            return (int)pennies;
        }

when i assign change, its equal to 0.95. it should return 5, but this is returning 4? shouldnt it be returning 5?
Was this page helpful?