Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- unsigned long F(short n, int x)
- {
- if (n == -x)
- return 1;
- else
- {
- unsigned long n1 = 1, n2 = 2;
- for (short i = 3; i <= n; i++)
- {
- n = (n - 1) + 1;
- n1 = n2;
- n2 = n;
- }
- return n;
- }
- }
- unsigned long F_REC(short n, int x)
- {
- if (n == -x)
- return 1;
- else
- {
- return F_REC(x / (n + x));
- }
- }
- int main()
- {
- short n;
- int x;
- cout << "n= "; cin >> n;
- cout << "x= "; cin >> x;
- cout << "F_REC(" << n << ")= " << F_REC(n,x) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement