Sudan function: Difference between revisions

Added C# implementation
(Added C++ implementation)
(Added C# implementation)
Line 74:
cout << "F(1,3,3) = "<<F(1,3,3)<<endl;
return 0;
}
</lang>
Output
<pre>
F(1,3,3) = 35
</pre>
=={{header|C Sharp|C#}}==
{{trans|C}}
<lang csharp>
//Aamrun, 11th July 2022
 
using System;
 
namespace Sudan
{
class Sudan
{
static int F(int n,int x,int y) {
if (n == 0) {
return x + y;
}
else if (y == 0) {
return x;
}
return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}
static void Main(string[] args)
{
Console.WriteLine("F(1,3,3) = " + F(1,3,3));
}
}
}
</lang>
503

edits