C program for FIBONACCI SERIES:-

C PROGRAM



#include<stdio.h>
int main()
{
int f=0,s=1,A,i,n;
printf("Enter number of terms: ");
scanf("%d",&n);
printf("\n It is %d terms Fibonacci series:\n",n);
for(i=0;i<n;i++)
{
  if(i<=1)
   {
     A=i;
    }
  else
    {
      A=f+s;
      f=s;
      s=A;
    }
printf("%d,",A);
}
return 0;
}




OUTPUT:







Post a Comment

0 Comments