Advertisement
Guest User

HlebTask2

a guest
Feb 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. include <iostream>
  2. using namespace std;
  3.  
  4. int calculate(int a, int b, int h) {
  5.     int currentH;
  6.     int days=0;
  7.     while(currentH < h){
  8.         currentH = currentH + a - b;
  9.         days++;
  10.     }
  11.     return days;
  12. }
  13.  
  14. int main(){
  15.     int a, b, h;
  16.     cin >>  a;
  17.     cin >> b;
  18.     cin >> h;
  19.     cout << calculate(a, b, h);
  20.      
  21.     return 0;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement