C PROGRAMMING

write a c program to print febonacci series upto a given number

#include <stdio.h>
#include <conio.h>
int main() {
int num1=0,num2=1,i,upto,feb;
printf("Enter a number upto which you want print Fibonacci series : ");
scanf("%d",&upto);
printf("Fibonacci series upto %d is:n",upto);
while(upto>=feb)
{
printf("%d n",feb);
feb=num1+num2;
num1=num2;
num2=feb;
}
return 0;
getch();
}

Related Articles

Leave a Reply

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

Back to top button