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

#include \"simpio.h\" #include <stdio.h> #include \"genlib.h\" //Constants //___

ID: 3558005 • Letter: #

Question

#include "simpio.h"

#include <stdio.h>

#include "genlib.h"

//Constants

//____________

//LowerLimit -- Starting value for the squence

//UpperLimit -- Final value of the sequence

int getResult(int n, int First, int Second);

int getResult(int n, int First, int Second)

{

int i, result, carryFirst, carrySecond;

if(i < n)

{

if(i==0)

{

result = 1;

}

result = First + Second;

if(i%2 !=0)

{

printf("%d 1", result);

carryFirst = result;

}

else if (i%2 ==0)

{

printf("%d 2 ", result);

carrySecond = result;

}

i++;

getResult(n, carryFirst, carrySecond);

printf("%d 3", result);

}

return(result);

}

int main()

{

int i=0, output= 1, storeFirst=0, storeSecond=1, n=0;

printf("This program computes the n-th Fibonacci number ");

printf("using the recursive formula. ");

printf("Please enter n:");

scanf("%d",&n);

output = getResult(n, 0, 1);

printf("%d", output);

return 0;

}

This is suppose to be a recursive function calculation the fibonacci series. Something with my recursive function is wrong.

Explanation / Answer

//Best Way to Calculate Fibonacci Series Using Recursion