#include<stdio.h>
int main () {
int a,b,n,next,count;
printf("how many terms are required 2<=n<=24\n");
scanf("%d",&n);
a=0;
b=1;
printf("\n\nFIBNONACCI TERMS ARE:\n");
printf("%8d%8d",a,b);
count=2;
while (count<n)
{
next=a+b;
printf("%8d",next);
a=b;
b=next;
count++;
}
printf("\n");
return 0;
}
Have a Read!
Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!
Saturday, January 29, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment