Write A Program for generating Fibonacci series
#include<stdio.h> #include<conio.h> void main ( ) { int a = 0, b=1, range, c = 0; printf (“enter range”); scanf (...
https://www.computersprofessor.com/2016/06/write-program-for-generating-fibonacci.html?m=0
#include<stdio.h>
#include<conio.h>
#include<conio.h>
void main ( )
{
int a = 0, b=1, range, c = 0;
printf (“enter range”);
scanf ( "%d”,& range);
printf ( “\n Fibonacci series \n”);
printf (% d \t %d” a, b);
c = a + b;
while ( c < = range)
{
printf("\t %d”, c);
a = b;
b = c;
c = a + b;
}
getch ();
}
Out Put:
enter range 10
Fibonacci series 0 1 1 2 3 5 8
Out Put:
enter range 10
Fibonacci series 0 1 1 2 3 5 8