Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Tuesday, September 27, 2022

C program to print fibonacci series using function

C program to print fibonacci series using function


#include<stdio.h>

#include<conio.h>

int fibo(int n);

main()

{

int a,i;

printf("Enter the number=");

scanf("%d",&a);

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

 {

 printf("%d\t",fibo(i));

 }

getch();

}


int fibo(int n)

{

if(n==0 || n==1)

return(1);

else

return (fibo(n-1)+fibo(n-2));

}


Output:



You may also read:

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages