img
Question:
Published on: 21 November, 2024

Write a C program to print the fibonacci series.

Answer:

 

#include<stdio.h>
#include<conio.h>
main()
{
	int n,f1,f2,f3;
	printf("\n enter how many number");
	scanf("%d",&n);
	f1=0;
	f2=1;
	printf("\n the fibonacci series = %d\t%d",f1,f2);
	do
	{
		f3=f1+f2;
		printf("\t%d",f3);
		f1=f2;
		f2=f3;
		n--;
	}while(n>2);
	getch();
}

OutPut:

Random questions