Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int FibBroj(int n)
- {
- int a=0,b=1,c;
- if (n==0) return 0;
- for (int i=2;i<=n;i++)
- {
- c=a+b;
- a=b;
- b=c;
- }
- return b;
- }
- int main()
- {
- int n;
- cin>>n;
- cout<<FibBroj(n)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement