Hi friends, would like to share something if Anyone wanted to know the C++ fibonacci program in simple way can go through this
Code:
// Program name : test051.c
// Print Fibonica series of nth numbers
#include <iostream.h>
#include <conio.h>
void main()
{
int n, first = 0, second = 1, third = 0;
clrscr();
cout <<"Enter Fibonica n th number : ";
cin >> n;
cout<<first<<" "<<second<<" ";
for(int i = 3; i <= n; i++)
{third = first + second;
cout<<third<<" ";
first = second;
second = third;
}
getch();
}
Output
Enter Fibonacci nth number : 10
0 1 1 2 3 5 8 13 21 34

Enter Fibonacci nth number : 15
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

As i am a beginner,i am learning all programming languages in simple way with easy solutions.

Last edited by shabbir; 18Dec2013 at 15:27.. Reason: Code blocks