Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. cout << "Hello world!" << endl;
  8. int s,//Na tyle lity trzeba kupici, aby otrzymac medal
  9. p,//Cena pierwszego towaru.
  10. k,//O tyle droższy kolejny towar.
  11. n,//Ilość towarów.
  12. suma;//suma litów wszystkich towarów.
  13.  
  14.  
  15. cout<<"Na ile litow trzeba kupic, aby otrzymac medal ? "; //65
  16. cin>>s;
  17. cout<<"Ile litow kosztuje pierwszy towar ? "; //17
  18. cin>>p;
  19. cout<<"O ile litow drozszy kolejny towar ? "; //3
  20. cin>>k;
  21. n=0;
  22.  
  23. while(suma==s)
  24. {
  25.  
  26. suma=suma+p;
  27. p=p+k;
  28. n++;
  29.  
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
  36. cout<<n;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement