I'm pretty new to programming. Doing a factorial problem, I'm getting back the incorrect values. I understand it's because they're too large, but I don't know how to fix it.
using System;
namespace Factorial
{
class Program
{
public static long factoring(int n)
{
if (n == 0)
{
return 1;
}
return n * factoring(n - 1);
}
static void Main(string[] args)
{
int lines, value;
lines = int.Parse(Console.ReadLine());
for (int i = 0; i < lines; i++)
{
value = int.Parse(Console.ReadLine());
Console.WriteLine(factoring(value));
}
}
}
}