Saturday, September 17

C program to Print a Non-Fibonacci series

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..!!  :):):)

13 comments :

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

thanks

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Thank you.

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Thank you @Anonymous for your feedback.!!

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Hello @Anonymous, Nice to hear that.. Keep reading.!! :)

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Great Work.. I saw One more easiest way to Write a C Program To Print Fibonacci Series

Anonymous said... Best Blogger Tips [Reply to comment] Best Blogger Templates

please help me out to print first n non-fibonacci numbers

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

thanks

v!p!n said... Best Blogger Tips [Reply to comment] Best Blogger Templates

You are welcome Unknown

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

can you explain the code

Senthil said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Easy to understand

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Easy to understand. Thank u

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Same program needed in java but . Can u help me reviewing it in java.

Unknown said... Best Blogger Tips [Reply to comment] Best Blogger Templates

Plz.. help me out.

Post a Comment