Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- double gotowka(double startowa,int n);
- double gotowka1(double startowa,int n);
- int main()
- {
- int n;
- double start;
- cout<<"ile miesiecy? :";
- cin>>n;
- cout<<"gotowka : ";
- cin>>start;
- cout<<gotowka(start,n)<<endl;
- cout<<gotowka1(start,n);
- getch();
- return 0;
- }
- double gotowka(double startowa,int n)
- {
- for(int i=1;i<=n;i++)
- {
- startowa = (startowa*1.05)-10;
- }
- return startowa;
- }
- double gotowka1(double startowa,int n)
- {
- if(n<1)
- return startowa;
- return gotowka1(startowa=(startowa*1.05)-10,n-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement