Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int counter(int numbers, int *num)
- {
- int counting = 0;
- while(*num >= numbers)
- {
- *num = *num - numbers;
- counting++;
- }
- return counting;
- }
- int main()
- {
- int num;
- scanf("%d", &num);
- printf("%d\n", num);
- printf("%d nota(s) de R$ 100,00\n", counter(100, &num));
- printf("%d nota(s) de R$ 50,00\n", counter(50, &num));
- printf("%d nota(s) de R$ 20,00\n", counter(20, &num));
- printf("%d nota(s) de R$ 10,00\n", counter(10, &num));
- printf("%d nota(s) de R$ 5,00\n", counter(5, &num));
- printf("%d nota(s) de R$ 2,00\n", counter(2, &num));
- printf("%d nota(s) de R$ 1,00\n", counter(1, &num));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement