//Write a program to print Fibonacci series.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=0,b=1,c=0,upto;
puts("Enter No. ...");
scanf("%d",&upto);
printf("%d\n%d\n",a,b);
while(c<upto)
{
c=a+b;
a=b;
b=c;
printf("%d\n",c);
}
return 0;
}
OUTPUT
0 Comments:
Post a Comment