C++ Program that input number and display Fibonacci Series .
A program that enter a number from user and display n fibonacci numbers.
Fibonacci Series.
#include<iostream>
#include<conio.h>
int main()
{
int first,second,next,n,count;
cout<<"How many fibonacci terms required:";
cin>>n;
first=0;
second=1;
count=2;
cout<<first<<"\t"<<second;
while(count<=n)
{
next=first+second;
cout<<"\t"<<next;
first=second;
second=next;
count++;
}
getch();
return 0;
}
C++ Program that input number and display Fibonacci Series .
Reviewed by Alpha
on
3/25/2017 09:48:00 pm
Rating:
No comments: