Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- double n=0,i=0;
- double ciag (double n)
- {
- if (n==1)
- return 0.5;
- if (n==2)
- return 1;
- if (n>2)
- return 3*ciag(n-2)+ciag(n-1);
- }
- main()
- {
- cout <<"Podaj ilosc liczb z ciagu, ktora cie interesuje: ";
- cin >> n;
- cout <<"Podane liczby to : ";
- for (i=1;i<=n;i++)
- cout << ciag(i) <<", ";
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement