## For practice 2

Points: 1
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Python3

This practice problem will require you to programme basic for loops.

Your task is to print the Fibonacci number sequence without using arrays.

The Fibonacci series starts with a=1 and a=1, and after that a[i]=a[i-2] + a[i-1].

You are expected to print the sequence of all Fibonacci numbers less than a given input N.

#### Input Specification

The input contains a single line with a single integer N ($$1 < N < 1000000000$$).

#### Output Specification

The first and second lines should contain only a single 1. Then, each line should contain a single integer which is the next Fibonacci number.

#### Sample Input

    10

#### Sample Output

    1
1
2
3
5
8

• admin  commented on May 28, 2020, 11:51 a.m. edit 2

Consider the following bare-bone code:

#include <cstdio>
int main() {
int n;
scanf("%d", &n);
int a = 1;
int b = 1;
int tmp;
printf("%d\n", a);
printf("%d\n", b);
for (...) printf("%d\n", a+b);
return 0;
}

Can you figure out a way to ONLY modify the for loop condition to solve this task? Please try.