fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int trzy(int kwota) {
  5. int ile = 0;
  6.  
  7. while (kwota>=5) {
  8. kwota=kwota-5;
  9. ile+=1;
  10. //cout <<"5"<<endl;
  11. }
  12.  
  13. while (kwota>=3) {
  14. kwota=kwota-3;
  15. ile+=1;
  16. //cout <<"3"<<endl;
  17. }
  18.  
  19. while (kwota>=1) {
  20. kwota=kwota-1;
  21. ile+=1;
  22. //cout <<"1"<<endl;
  23. }
  24. return ile;
  25. }
  26.  
  27. int main() {
  28. // sprawdź działanie funkcji
  29. cout << trzy(11) << " " << trzy(99) << endl;
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
3 21