**McCarthy 91 function** is a recursive function used within computer science, its definition is:

Now how we implement this **McCarthy 91 function** in our C++ code, Â have a look at the below code:

//McCarthy 91 Function #include<iostream> using namespace std; int M(int n) { if(n>100) return(nâ€“10); else return(M(M(n+11))); //answer is 91 upto 101 } int main() { int num; cout<<â€œenter a number â€œ; cin>>num; int m = M(num); cout<<m<<endl; }

Now in the above function M() we implemented the mathematical form of the **McCarthy 91 function** by using recursion because recursion is its easiest approach, we used the number taken as an argument and asked if number is greater than 100 then return number-10 else return the recursive statement as defined in the definition, and it returns the valueÂ according to **McCarthy 91 function**.