Problem:
Write a C program to print the numbers between 1 to n that do not appear in Fibonacci series.
Program:
#include<stdio.h>
void main()
{
int n,i,f0=0,f1=1,f2=f0+f1;
printf("enter the number of terms");
scanf("%d",&n);
while(f2<=n)
{
for(i=f1+1;i<f2;i++) /*print all numbers between f1 and f2 */
{
printf("%d\t",i);
}
f0=f1;
f1=f2;
f2=f0+f1;
}
}
No comments:
Post a Comment