Skip to content

anonymous /gist:0a83f05b6d0c3727b0c9 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#include <stdio.h>
#include <iostream>
using namespace::std;
int mcCarthy91(int n,int & output)
{
if(n>100)
{
printf("M(%d) since %d is greater than 100\n",output-10,output);
output-=10;
return n - 10;
}
else
{
printf("M(M(%d)) since %d is less than 100\n",output+11,n);
output+=11;
return mcCarthy91(mcCarthy91(n+11,output),output);
}
}
int main()
{
int n = 50;
std::cout<<"please enter an int"<<endl;
cin>>n;
printf("M(%d)\n",n);
int out = mcCarthy91(n,n);
printf("output is %d",out);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.