There are N stairs, and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top (order...


In C++ language write the program to read the value of integer n and display the number of ways to reach the top.


There are N stairs, and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at<br>a time. Count the number of ways, the person can reach the top (order does not matter).<br>Note: Order does not matter means for n=4 {1 2 1},{2 1 1},{1 1 2} are considered same.<br>Testcases: {3,4,5,6}<br>Output: {2,3,3,4}<br>

Extracted text: There are N stairs, and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs at a time. Count the number of ways, the person can reach the top (order does not matter). Note: Order does not matter means for n=4 {1 2 1},{2 1 1},{1 1 2} are considered same. Testcases: {3,4,5,6} Output: {2,3,3,4}

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here