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 (...

#include<stdio.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

Related

C Programs 6233544601322036404

Post a Comment

emo-but-icon

item