Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

PROGRAM TO GENERATE n FIBONACII SEQUENCE

 // PROGRAM TO GENERATE N FIBONACII SEQUENCE

#include <stdio.h>

void main()
{
 int a=0,b=1,n,i,sum=0;
  printf("enter a number:");
  scanf("%d",&n);
 
  printf("%d\n%d\n",a,b);

  for(i=1 ; i<=n ; i++)
   { sum=a+b;
     a=b;
     b=sum;

     printf("%d\n",sum);
    }
}

Post a Comment

0 Comments