You are on page 1of 1

#include <stdio.

h>
void main()
{
int OldNum, NewNum, FibNum, MaxNum;
printf("
Generate Fibonacci Numbers till what number? ");
scanf("%d", &MaxNum);
OldNum=0;
NewNum=1;
FibNum = OldNum + NewNum;
printf("%d, %d, %d, ", OldNum, NewNum, FibNum);
for(;;)
{
OldNum = NewNum;
NewNum = FibNum;
FibNum = OldNum + NewNum;
if(FibNum > MaxNum)
{
printf("
");