Write a program in C++ to print the fibonacci series
#include<iostream.h>
#include<conio.h> void main() { int n,first=0,second=1,next,c; cout<<”Enter the number of terms”; cin>>n; cout<<”First “<<n<<” terms of Fibonacci series are :- \n“; for(c=0;c<n;c++) { If(c<=1) { next=c; } else { next=first+second; first=second; second=next; } cout<<next; } getch(); } |