text: Count ways to reach the nth stair using step 1 , 2 or 3 | C ++ Program to find n - th stair using step size 1 or 2 or 3. ; Returns count of ways to reach n - th stair using 1 or 2 or 3 steps . ; Driver code
code: #include <iostream> NEW_LINE using namespace std ; class GFG { public : int findStep ( int n ) { if ( n == 1 n == 0 ) return 1 ; else if ( n == 2 ) return 2 ; else return findStep ( n - 3 ) + findStep ( n - 2 ) + findStep ( n - 1 ) ; } } ; int main ( ) { GFG g ; int n = 4 ; cout << g . findStep ( n ) ; return 0 ; }