Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2. #define SIZE 12
  3. int main()
  4. {
  5.  
  6.     int amount, notes;
  7.     int moznosti;
  8.     moznosti = 0;
  9.     int denominations[SIZE] = {5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1};
  10.  
  11.     printf("Zadejte částku, pro kterou chce zobrazit možnosti rozměněni: ");
  12.     scanf("%d", &amount);
  13.     int castka = amount;
  14.     printf("\n");
  15.     printf("počet možností: %d \n", moznosti);
  16.     for (int i = 0; i < SIZE; i++)
  17.     {
  18.         notes = amount / denominations[i];
  19.  
  20.         if (notes)
  21.         {
  22.             amount = amount % denominations[i]; // remaining money
  23.  
  24.             printf("%d * %d = %d kc \n", notes, denominations[i],
  25.                 notes * denominations[i]);
  26.         }
  27.  
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement