fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. // zdefiniuj funkcję
  5. int trzy(int kwota) {
  6. int ile=0;
  7. ile=ile+kwota/5;
  8. kwota=kwota%5;
  9. cout<<" 5 "<<ile<<endl;
  10.  
  11. ile=ile+kwota/3;
  12. kwota=kwota%3;
  13. cout<<" 3 "<<ile<<endl;
  14.  
  15. ile=ile+kwota/1;
  16. kwota=kwota%1;
  17. cout<<" 1 "<<ile<<endl;
  18.  
  19. return ile;
  20. }
  21.  
  22. int main() {
  23. cout << trzy(11) << " " << trzy(99) << endl;
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5216KB
stdin
Standard input is empty
stdout
 5 2
 3 2
 1 3
3  5 19
 3 20
 1 21
21