Guest User

Untitled

a guest
Jan 22nd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int i,p,s,n,w;
  6. cin>>p;
  7. cin>>s;
  8. cin>>n;
  9. w=p;
  10. for(i=3;i<=n;i=i+2)
  11. {
  12. p=p+s;
  13. w=w+p;
  14. }
  15. cout<<p<<endl;
  16. cout<<w<<endl;
  17. return 1;
  18. }
Add Comment
Please, Sign In to add comment