Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Hello world!" << endl;
- int s,//Na tyle lity trzeba kupici, aby otrzymac medal
- p,//Cena pierwszego towaru.
- k,//O tyle droższy kolejny towar.
- n,//Ilość towarów.
- suma;//suma litów wszystkich towarów.
- cout<<"Na ile litow trzeba kupic, aby otrzymac medal ? "; //65
- cin>>s;
- cout<<"Ile litow kosztuje pierwszy towar ? "; //17
- cin>>p;
- cout<<"O ile litow drozszy kolejny towar ? "; //3
- cin>>k;
- n=0;
- while(suma==s)
- {
- suma=suma+p;
- p=p+k;
- n++;
- }
- cout<<n;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement