fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int trzy(int kwota) {
  6.  
  7. int ile =0;
  8.  
  9. while (kwota>=5){
  10.  
  11. kwota =kwota-5;
  12.  
  13. ile +=1;
  14.  
  15. }
  16.  
  17. while (kwota>=3){
  18.  
  19. kwota =kwota-3;
  20.  
  21. ile +=1;
  22.  
  23. }
  24.  
  25. while (kwota>=1){
  26.  
  27. kwota =kwota-1;
  28.  
  29. ile +=1;
  30.  
  31. }
  32.  
  33. return ile;
  34.  
  35. }
  36.  
  37. int main() {
  38.  
  39. cout << trzy(11) << " , " << trzy(99) << endl;
  40.  
  41. return 0;
  42.  
  43. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
3 , 21