FIBONACCI SERIES - C-Tutorial

Latest

Monday, 26 September 2016

FIBONACCI SERIES

/*  FIBONACCI SERIES */
FIBONACCI SERIES

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

main()
{
int a=0,b=1,c,i=1,n;
clrscr();
printf("\n Enter n value:");
scanf("%d",&n);
printf("\n FIBONACCI SERIES:");
printf("%3d%3d",a,b);
while(i<=n)
{
c=a+b;
printf("%3d",c);
a=b;
b=c;
i=i+1;
}
getch();
}

No comments:

Post a Comment