Hi, I'm having trouble understanding how modulus works. For an exercise I have to write a program where the user inputs how much change is needed in 2 dollar and 1 dollar coins as well as cents (50, 10, 5, 2, 1 cents). This is what I was thinking but doesn't work:
int x = input % 200;
int dollar2 = x / 200;
int dollar1 = input % 100;
int cent50 = x % 50;
int cent20 = input % 20;
int cent10 = x % 10;
int cent5 = input % 5;
int cent2 = x % 2;
int cent1 = input % 1;
Thanks