Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void fibonacci(int ile)
- {
- int a = 0, b = 1, c = 0;
- for(int i = 0; i < ile; ++i)
- {
- a = b;
- b = c;
- c = a + b;
- cout << c << '\t';
- }
- }
- int main()
- {
- int liczba;
- cout << "Podaj liczbe naturalna: ";
- cin >> liczba;
- fibonacci(liczba);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment