Programming Languages

PROGRAM TO FIND THE FIBONACCI SERIES USING FUNCTION

/* PROGRAM TO FIND THE FIBONACCI SERIES USING FUNCTION */

#include<stdio.h>
#include<conio.h>

void fib(int n);
void main()
{
int n;
clrscr();
printf(“ENTER THE VALUE OF N: “);
scanf(“%d”,&n);
fib(n);
getch();
}
void fib(int n)
{
int a=0,b=1,i,temp,f;
printf(“THE FIBONACCI SERIES IS \n\n”);
printf(“%d %d “,a,b);
for(i=1;i<=n-2;i++)
{
f=a+b;
a=b;
b=f;
printf(” %d “,f);
}
}

ANIL VERMA
Hello Everyone, Welcome to A. V. Powertech.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.