Question: What is wrong with this code in C + + , meant to use user defined function ( no recursion ) to calculate fibonacci sequence?
What is wrong with this code in C meant to use user defined function no recursion to calculate fibonacci sequence?
#include
using namespace std;
int x;
int fibonacciint
int newnumber x x ;
cout newnumber;
return newnumber;
int main
int n ;
int newnumber ;
int x ;
cout
Enter number up to which you would like a fibonacci sequence for endl;
cin x;
for int i ; i x; i
if x
cout x endl;
else if x
cout x endl;
else
i x;
x;
fibonaccix;
cout newnumber endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
