Advertisement
Eduardo_Pires

óia esse

Dec 6th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int counter(int numbers, int *num)
  4. {
  5.     int counting = 0;
  6.     while(*num >= numbers)
  7.     {
  8.         *num = *num - numbers;
  9.         counting++;
  10.     }
  11.     return counting;
  12. }
  13.  
  14. int main()
  15. {
  16.     int num;
  17.     scanf("%d", &num);
  18.    
  19.     printf("%d\n", num);
  20.     printf("%d nota(s) de R$ 100,00\n", counter(100, &num));
  21.     printf("%d nota(s) de R$ 50,00\n",  counter(50, &num));
  22.     printf("%d nota(s) de R$ 20,00\n",  counter(20, &num));
  23.     printf("%d nota(s) de R$ 10,00\n",  counter(10, &num));
  24.     printf("%d nota(s) de R$ 5,00\n",   counter(5, &num));
  25.     printf("%d nota(s) de R$ 2,00\n",   counter(2, &num));
  26.     printf("%d nota(s) de R$ 1,00\n",   counter(1, &num));
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement