MCPcopy 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>
3using namespace std;
4int 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}
12int main(){
13 int N;
14 cout<<"Enter a positive number : ";

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected