Program to print Fibonacci Series up-to n numbers.
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, x=0, y=1, z;
clrscr();
printf ("Enter the number of terms for Fibonacci Series: ");
scanf ("%d", &a);
printf ("\nFibonacci Series is: ");
for (b = 1; b <= a; ++b)
{
printf ("%d\t", x);
z = x + y;
x = y;
y = z;
}
getch();
}
#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, x=0, y=1, z;
clrscr();
printf ("Enter the number of terms for Fibonacci Series: ");
scanf ("%d", &a);
printf ("\nFibonacci Series is: ");
for (b = 1; b <= a; ++b)
{
printf ("%d\t", x);
z = x + y;
x = y;
y = z;
}
getch();
}