Fibonacci Series In C-Gaurav Pali


 Write a program in C to print the Fibonacci Series


Note:- In the Fibonacci series, every next number is the sum of the previous two numbers.


#include<stdio.h>

#include<conio.h>

void main()

 {

  int a=0,b=1,c,i,n;

  clrscr();

  printf("Input number of terms you want to print");

  scanf("%d",&n);

  printf("%d %d ",a,b);

  for(i=1;i<=n;i++)

   {

    c=a+b;

    a=b;

    b=c;

    printf("%d ",c);

   }

  getch();

 }

Program ScreenShot


OutPut


Popular posts from this blog

M3-R4 O-Level Jan-20 MCQ With Answers

Write A Program in C To Swap Two Numbers Without Using Third Variable