Q. write C program for Fibonacci sires.
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,k=0,j=1,temp,l;
clrscr();
printf("enter the no");
scanf("%d",&n);
printf("\n%d",k);
printf("%d",j);
for(i=1;i<=n;i++)
{
l=k+j;
printf("%d",l);
temp=k;
k=j;
j=temp+j;
}
getch();
}
No comments:
Post a Comment