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

IGNOU Solved Assignment 2023-24 | BCS-012 Basic Mathematics BCA(I)012/Assignment/2023-24

MCS-051 : ADVANCED INTERNET TECHNOLOGIES | 1. (a) Write a web application using JSP and JDBC that takes a bank account number as input and displays the account balance.

MCS054 TEE June 2021 Q1(b) | Bisection Method