Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/chaharnishant11/CodeIn10DSA
/ countWays
Function
countWays
Recursion/Code/NthStair.cpp:4–11 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
2
#include <iostream>
3
using namespace std;
4
int countWays(int n){
5
if (n==1 || n==2){
6
return n;
7
}
8
else{
9
return countWays(n-1)+countWays(n-2);
10
}
11
}
12
int main(){
13
int N;
14
cout<<
"Enter a positive number : "
;
Callers
1
main
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected