Generate First N Fibonnaci Series

Program:


    #include<iostream.h>
    #include<conio.h>
void main() { int a,b,next,n,count; clrscr(); cout<<"\n How many Fibonnaci terms required >=2 and <=24?\n "; cin>>n; a=0;b=1; cout<<"\nFirst  "<<n<<" Fibonnaci terms are:\n"; cout<<a<<' '<<b; count=2; while(count<n) { next=a+b; cout<<' '<<next; count++; a=b; b=next; } getch(); }
Powered by nasrullah.in - TechnoNasr 2003-2020.
Designed & Developed by Mohamed Nasrullah.M