aboutsummaryrefslogtreecommitdiff
path: root/challenge-201/eric-cheung/python/ch-2.py
blob: 8aaeccba36084610a73e8c395dcaa4c40f9959dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Remarks
## https://theweeklychallenge.org/blog/perl-weekly-challenge-201/
## https://www.geeksforgeeks.org/count-ways-reach-nth-stair/

## Python Program to Count Ways to Reach Nth stair
 
## Recursive Function to Find Nth Fibonacci Number
def GetFibNum(nInput):

    if nInput <= 1:
        return nInput

    return GetFibNum(nInput - 1) + GetFibNum(nInput - 2)

 
## Driver Program
nInputNum = 5

print ("Number of Ways: " + str(GetFibNum(nInputNum + 1)))
 
## Contributed by Harshit Agrawal