Need help writing this code C program that computes The Fibo
Need help writing this code:
C++ program that computes: The Fibonacci sequence plus the golden ratio. The golden ratio will be computed in 3 different ways. 1) The ratio of the last 3 numbers from the Fibonacchi series 2) Using your own generated sine and cosine functions by means of finite series (the use of the cmath library or any of its variations will not be allowed for this project) If you use them then the submission will be automatically graded as ZERO METHODOLOGY: Your code must display a very simple ONE question menu: • The number of decimals used as the precision required to compute the golden ratio
Solution
Only for fibonacci
1)#include<iostream>
using namespace std;
main()
{
int n, i, a= 0, b= 1,c;
cout << \"Enter the number of terms of Fibonacci series you want\" << endl;
cin >> n;
cout << \"First \" << n << \" terms of Fibonacci series are :- \" << endl;
for ( i = 0 ; i < n ; i++ )
{
if ( i <= 1 )
c = i;
else
{
c = a+ b;
a= b;
b =c;
}
cout << c<< endl;
}
return 0;
}
2)including the both
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MIN 0.0001
int main()
{
unsigned long a=0,a=1,k;
double dif;
do
{
dif=double(b)/double(a);
k=b;
b+=a;
a=k;
}
printf(\"%d\",k);
while (fabs(double(b)/double(a)-dif)>MIN);
printf(\"%lf\",double(b)/double(a));
}

