Question:Write a program to generate the Fibonacci series in c 

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

    //Taking maximum numbers form user
    printf("Enter the number range:");
    scanf("%d",&r);

    printf("FIBONACCI SERIES: ");
    printf("%ld %ld",i,j); //printing firts two values.

    for(k=2;k<r;k++){
         f=i+j;
         i=j;
         j=f;
         printf(" %ld",j);
    }
  
    return 0;
}
Sample output: Enter the number range: 15 FIBONACCI SERIES: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 

+ ExplanationNot Moderated
+ Report
Total Preview: 519
Write a program to generate the Fibonacci series in c
Copyright © 2024. Powered by Intellect Software Ltd