Show Mobile Navigation

Wednesday, December 12, 2012

C program to print fibonacci series 0 1 1 2 3 5 8.....

Ashok royal - 10:51


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

void main()
{
int a=0,b=1,c,i,n;
clrscr(); 

printf("Enter how many elements?");
scanf("%d",&n);
printf("\n%d %d",a,b);


for(i=2;i<n;++i)
{
c=a+b;
printf(" %d",c);
a=b;
b=c;
}
getch(); 
}

0 comments:

Post a Comment

Comments : Read Them Or Add One to promote us