Computer Science, asked by dxgaming2942, 8 months ago

5. Is the loop in the code below infinite ? How do you know (for sure) before you run it?
m = 3
n = 5
whilen < 10:
m = n-1
n = 2* nm
print(n, m)​

Answers

Answered by Anonymous
2

Answer:

Consider the example shown in the diagram. The value of n is 3. There are 3 ways to reach the top. The diagram is taken from Easier Fibonacci puzzles

Examples:

Input: n = 1

Output: 1

There is only one way to climb 1 stair

Input: n = 2

Output: 2

There are two ways: (1, 1) and (2)

Input: n = 4

Output: 5

(1, 1, 1, 1), (1, 1, 2), (2, 1, 1), (1, 2,

Similar questions