Write a
program to find Fibonacci series
#include<stdio.h>
#include<conio.h>
int main()
{
int i, a, b, c,
n;
clrscr();
printf("how
many terms do you want");
scanf("%d",&n);
a=1;
b=1;
printf(" \n %d \n %d",a,b);
for(i=1;
i<=n-2; i++)
{
c=a+b;
a=b;
b=c;
printf("\n %d",c);
}
getch();
return(0);
}
OUTPUT:
How many terms do
you want 4
1 1
2 3
No comments:
Post a Comment