Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Java Problem Statement Different Ways of Climbing Stairs

Problem Statement : There are n stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs or 3 stairs at a time. Count the number of ways, the person can reach the top.

Write a java program which solves the above problem statement.

Eg : 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=3 Output: 4 There are two ways:(1,1,1) (1,2) (2,1) (3)

Comments