I have studied C and I came across a very difficult problem that after much trying, I gave up and went to get an algorithm ready on the internet to study it, but the expression n% = 100 I could not understand at all. I looked at various programming and math sites but all I found was that the percentage symbol in the middle of two integers returned the rest of the division, and I already knew that, but when does it have an equality next?
If the problem is the 1018 of the URI startup module.
Here is the code I am studying:
#include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", n);
printf("%d nota(s) de R$ 100,00\n", n/100);
n %= 100;
printf("%d nota(s) de R$ 50,00\n", n/50);
n %= 50;
printf("%d nota(s) de R$ 20,00\n", n/20);
n %= 20;
printf("%d nota(s) de R$ 10,00\n", n/10);
n %= 10;
printf("%d nota(s) de R$ 5,00\n", n/5);
n %= 5;
printf("%d nota(s) de R$ 2,00\n", n/2);
n %= 2;
printf("%d nota(s) de R$ 1,00\n", n);
return 0;
}