Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<stdio.h>
- using namespace std;
- int main()
- {
- int x,a=0,b=1,frwrd;
- cout<<"Enter the number of terms"<<endl;
- cin>>x;
- cout<<"Fibonacci series are : ";
- for (int c=0;c<x;c++)
- {
- if (c<=1)
- frwrd=c;
- else
- {
- frwrd=a+b;
- a=b;
- b=frwrd;
- }
- cout<<frwrd<<" ";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement