Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //saidow
- using namespace std;
- int main()
- {
- int n;
- cout<<"Fibonacci hesaplamak istediginiz sayiyi giriniz: "<<endl;
- cin>>n;
- int a=1;
- int b=1;
- cout<<"Fibonacci Serisi = "<<endl;
- if(n==0)
- cout<<"0 degerinden farkli sayi gir."<<endl;
- else if(n==1)
- cout<<1<<endl;
- else{
- for(int i=0; i<n-2; i++)
- {
- cout<<a<<endl<<b<<endl;
- int c = a+b;
- a=b;
- b=c;
- cout<<c<<endl;
- }
- return 0;
- }
- } //saidow
Add Comment
Please, Sign In to add comment