www.cprogramming.tk

www.cprogramming.tk

C++ Program that input number and display Fibonacci Series .

A program that enter a number from user and display n fibonacci numbers.

Fibonacci Series.



using namespace std;
#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 . C++ Program that input number and display Fibonacci Series . Reviewed by Shoaib Jameel on 3/25/2017 09:48:00 pm Rating: 5

No comments:

Theme images by mariusFM77. Powered by Blogger.