Pages

Sunday 3 February 2019

Fibonacci series

// prg to illustrate fibonacci series of a given number
#include<stdio.h>
void main()
{
 int n,i,past=0,present=1,future;
 printf("enter any number:");
 scanf("%d",&n);
 printf("\n %d \n%d",past,present);
 future=past+present;
 printf("\n %d",future);
 for(i=0;i<n-3;i++)
  {
   past=present;
   present=future;
   future=past+present;
   printf("\n %d",future);
  }
}

 output

No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...