Sunday 6 October 2013

C program to print fibonacci series upto a given number

#include<stdio.h>
#include<conio.h>
int main()
{
    int m=0,n=1,temp,a;
    printf("enter the value upto which you want to print fibonacci numbers\n");
    scanf("%d",&a);
    printf("%d\n%d\n",m,n);
    while(n<a)
    {
               temp=m;
               m=n;
               n=temp+n;
               while(n<a)
               {
               printf("%d\n",n);
               break;
               }
    }
    _getch();
    return 0;
}
              
    
    
    

No comments:

Post a Comment