Tuesday, 4 October 2011

Program to print fibonacci series of 1 to 20 nos.


#include<stdio.h>
#include<conio.h>
void main()
{
int fib=0, a=1,b=0, i ;
clrscr();

printf("\n Fibonacii sereis of 1st 20 nos. is :");

for( i =0 ; i <20; i++)
{
printf("\n%d . %5d",i+1,fib);
fib = a + b;
a= b;
b=fib;
}
getch();
}

No comments:

Post a Comment