Saturday, 30 December 2017

C program to print fibonacci series upto

#include<stdio.h>
int main( )
{
   int n, a=1, b=1, temp=0;
  
   printf("Enter the number");
   scanf("%d",&n);

   printf("Fibonacci series is %d %d %d",temp,a,b);


   while(a+b<=n)

     {
           temp=a;
           a=b;
           b=a+temp;
         
           printf("%d ",b);
     }
 return 0;
}



No comments:

Post a Comment

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...