Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- /**
- recursivitate indirecta
- f(n)= 1 n=1
- 3+g(n-1)altfel
- g(n)= 1 n=1
- 2*f(n-1)altfel
- */
- ///prototipul functie g
- int G(int );
- ///functia f
- int F(int n)
- {
- if(n==1)return 1;
- else return 3+G(n-1);
- }
- int G(int n)
- {
- if(n==1)return 1;
- else return 2*F(n-1);
- }
- int main()
- {
- int n;
- cin>>n;
- cout<<F(n)<<" "<<G(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement