Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int f(unsigned int n)
- {
- if(n<2)
- return 0;
- return 2+f(n-1)-f(n-2)
- }
- int main()
- {
- int n;
- cout<<"Podaj liczbę: ";
- cin>>n;
- cout<<n<<" wyraz ciągu ma wartość "<<f(n)<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement