Factorial/permutations/combinations program
Signed 64-bit integer (long in both Java and C#) can have values between approximately -9 · 1018 and 9 · 1018. Unsigned 64-bit integer (ulong in C#) can have values between 0 and approximately 1.8 · 1019. The value of 20! is approximately 2 · 1018, so it fits comfortably both to long and ulong. The value of 21! is approximately 5 · 1019, so it doesn't fit even into ulong.

Because of this, 20! should be computed correctly both in Java and c#, but 21! should be incorrect in both, no matter whether you use long or ulong.

If you want to make sure you are getting correct results in C#, you can use unchecked. If you do that and the computation overflows, you will get an exception.

What should you do if you want to compute larger values than 20!? The best option would be if there was some type that could represent arbitrarily large integers. Fortunately, both languages have them, there is BigInteger in C# and BigInteger in Java.