Program to find the fibonacci numbers between a given range

Here is the slightly modified version of the previous program, which is flexible to find the Fibonacci numbers between the given range.

Logic:  Fibonacci numbers are the the members of the Fibonacci series, which grows up accord to Fibonacci rule. The rule states, the present number in the series is the sum of past number and and the number before past, with the initial condition that, series starts from 0, and the second term is  1. Mathematically,

F(n+1) = F(n) + F(n-1)           // F(1) =0 and F(2) = 1

Taking the upper and lower limit from the user, tracing the Fibonacci series with a while loop, finding the present Fibonacci member and printing that only if the same falls under the user specified range.

Program to find the fibonacci numbers between a given range

void main()
int lim_up, lim_low, A=0, B=1, C;
printf(“\n\n\t ENTER THE LOWER LIMIT…: “);
scanf(“%d”, &lim_low);
printf(“\n\n\t ENTER THE UPPER LIMIT…: “);
scanf(“%d”, &lim_up);
printf(“\n\n\t FIBONACCI NUMBERS ARE…: “);
printf(“\n\n\t\t\t%d”, A);
C = A + B;
A = B;
B = C;

Download exe and source code here.

Editorial Team
Editorial Team

We are a group of young techies trying to provide the best study material for all Electronic and Computer science students. We are publishing Microcontroller projects, Basic Electronics, Digital Electronics, Computer projects and also c/c++, java programs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.