Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help writing this code: C++ program that computes: The Fibonacci sequence p

ID: 3922153 • Letter: N

Question

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

Explanation / Answer

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));

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote