Q:- Write a program in C to print FIBONACCI series up to a limit.
The first two numbers in the Fibonacci sequence are 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
#include<conio.h>
#include<stdio.h>
void main ( )
{
int a, b, c, d;
clrscr ( );
printf("\n Enter the limit\n");
scanf("%d");
printf("\n Fibonacci series from 0 to %d" , d);
printf("\n%d %d" , a,b);
c=a+b;
while(c<=d)
{
printf("%d",c);
a=b;
b=c;
c=a+b;
}
getch ( );
}
BY:- DANISH BEIGH
email id:- beigh.danish@gmail.com
The first two numbers in the Fibonacci sequence are 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
#include<conio.h>
#include<stdio.h>
void main ( )
{
int a, b, c, d;
clrscr ( );
printf("\n Enter the limit\n");
scanf("%d");
printf("\n Fibonacci series from 0 to %d" , d);
printf("\n%d %d" , a,b);
c=a+b;
while(c<=d)
{
printf("%d",c);
a=b;
b=c;
c=a+b;
}
getch ( );
}
BY:- DANISH BEIGH
email id:- beigh.danish@gmail.com
No comments:
Post a Comment
Tell Us What You've Got...