/*******************************************************
* Program to generate a Fibonacci sequence
********************************************************/
#include<stdio.h> // include stdio.h
int main()
{
long int x = 0, y = 1, z;
int terms, i = 1;
printf("Enter no. of terms: \n");
scanf("%d", &terms); // to suppress the compiler warning in Linux replace %d with %zu
printf("%d ", y);
while(i <= terms - 1)
{
z = x + y;
x = y;
y = z;
printf("%d ", z); // to suppress the compiler warning in Linux replace %d with %zu
i++;
}
return 0;
}