Facebook
From Diminutive Ibis, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 821
  1. // zadanie 6
  2. #include <cstdlib>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.     int kwota=21;
  10.     int licz_5=0;
  11.     int licz_2=0;
  12.     int licz_1=0;
  13.    
  14.             if (kwota>=5)
  15.             {
  16.                 licz_5 = kwota/5;
  17.                 kwota = kwota - 5 * licz_5;
  18.             }
  19.             if (kwota>=2)
  20.             {
  21.                 licz_2 = kwota/2;
  22.                  kwota = kwota - 2 * licz_2;
  23.             }
  24.             if (kwota>=1)
  25.             {
  26.                 licz_1 = kwota / 1;
  27.                 kwota=kwota - 1*licz_1;
  28.             }
  29.     int suma_banknotow = licz_5 + licz_2 + licz_1;
  30.     cout<<"suma banknotów: "<< suma_banknotow<< endl;
  31.     system("PAUSE");
  32.     return EXIT_SUCCESS;
  33. }
  34.