Recent

Comments

Follow us on Facebook

Sunday 12 November 2017

Write a program to generate Fibonacci number up to 500. Consider the following sequence of numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34,....

C++ Program to Generate Fibonacci Series

Fibonacci Series is in the form of 0, 1, 1, 2, 3, 5, 8, 13, 21,...... To find this series we add two previous terms/digits and get next term/number.
fibonacci

Fibonacci Series Program in C++

#include<iostream.h>
#include<conio.h>
using namespace std;
 main()
{
int i,no, first=0, second=1, next;
clrscr();
first=0;
second=1;
cout<<"Enter nubmer of terms for Series: ";
cin>>no;
cout<<"Fibonacci series are: \n";
for(i=0; i<no; i++)
{
cout<<"\n"<<first;
next = first + second;
first = second;
second = next;
}
getch();
}

Output

Enter nubmer of terms for Series: 7
Fibonacci series are:
0
1
1
2
3
5
8

0 on: "Write a program to generate Fibonacci number up to 500. Consider the following sequence of numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34,...."

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix.

Write a program, that takes 16-Elements in Two-Dimensional-Array that has 4 rows & 4 columns, then display the diagonal of Matrix. ...

propeller ads

PropellerAds