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;
}



Post a Comment

0 Comments