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. }
  11. while (kwota>=3) {
  12. kwota=kwota-3;
  13. ile+=1;
  14. }
  15. while (kwota>=1) {
  16. kwota=kwota-1;
  17. ile+=1;
  18. }
  19. return ile;
  20. }
  21.  
  22. int main() {
  23. cout << trzy(11) << " , " << trzy(99) << endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
3 , 21