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

No do or for statements please. Strictly if, while, and else. Also, it needs a s

ID: 3672955 • Letter: N

Question

No do or for statements please. Strictly if, while, and else. Also, it needs a separate function!

By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two; for example, the first 6 Fibonacci numbers are 0,1,1,2, 3, 5. Write a program that asks the user for a number between 5 and 11 (inclusive) and then displays that many Fibonacci numbers. YOU MUST write a function called fibonacci which is called from main as follows: if ((num 5) || (num 11)) cout "Please follow the directions!" endl; else { total = fibonacci(num); cout endl; cout "Total is "; cout total; cout endl;

Explanation / Answer

Hello I could solve in c

Please see the below code:

#include<stdio.h>
int main(){
    int k=2,r;
    long int i=l,j=1,f;

    printf("Enter the number range:");
    scanf("%d",&r);
    if(r <5 || r>11){
    printf("Fibonacci series is: %ld %ld",i,j);

    while(k<r){
         f=i+j;
         i=j;
         j=f;
         printf(" %ld",j);
          k++;
    }
   }

    return 0;
}

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