Simple printing series using while() loop.
//Fibonacci series in C
#include<stdio.h>
//1 2 3 5 8 13 ...
//a b
// a b
int main()
{
int a, b, c;
a = 1;
b = 2;
while (a < 90)
{
printf("%d\n", a);
c = b;
b = a + b;
a = c;
}
return 0;
}
No comments:
Post a Comment