Program to compute the Fibonacci series
#include <iostream>
using namespace std;
int main(){
int a, b,x,y,n,ct;
a = 0;
b = 1;
cout
<< a << endl;
cout
<< b << endl;
cout
<< "Enter
Number"
<< endl;
cin
>> n;
for (ct =1 ; ct <= n - 2; ct++){
x =
a + b;
cout
<< x << endl;
y =
a;
a =
b;
b =
x;
}
system("pause");
return 0;
}
Comments
Post a Comment