Write a C program to generate non-fibonacci series to given Limit:
#include<stdio.h>
#include<conio.h>
main()
{
int n,a,b,c,d,x;
a=0;
b=1;
c=0;
printf("Enter the upper range of the series:");
scanf("%d",&n);
while(c<=n)
{
c=a+b;
a=b;
b=c;
d=a+b;
for(x=c+1;x<d;x++)
{
if(x<=n)
printf("%d",x);
else
break;
}
}
getch();
}
I hope this code was useful for u!!
Have a better program for ths prblm??
Feel free to comment it here..!! :):):)
#include<stdio.h>
#include<conio.h>
main()
{
int n,a,b,c,d,x;
a=0;
b=1;
c=0;
printf("Enter the upper range of the series:");
scanf("%d",&n);
while(c<=n)
{
c=a+b;
a=b;
b=c;
d=a+b;
for(x=c+1;x<d;x++)
{
if(x<=n)
printf("%d",x);
else
break;
}
}
getch();
}
I hope this code was useful for u!!
Have a better program for ths prblm??
Feel free to comment it here..!! :):):)
13 comments :
thanks
Thank you.
Thank you @Anonymous for your feedback.!!
Hello @Anonymous, Nice to hear that.. Keep reading.!! :)
Great Work.. I saw One more easiest way to Write a C Program To Print Fibonacci Series
please help me out to print first n non-fibonacci numbers
thanks
You are welcome Unknown
can you explain the code
Easy to understand
Easy to understand. Thank u
Same program needed in java but . Can u help me reviewing it in java.
Plz.. help me out.
Post a Comment