我只是运动有一些问题..我必须编写一个程序,询问用户N的值,然后计算N!使用递归.我写了类似的东西
namespace ConsoleApplication19
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("This program will calculate a factorial of random number. Please type a number");
String inputText = Console.ReadLine();
int N = int.Parse(inputText);
String outputText = "Factorial of " + N + "is: ";
int result = Count(ref N);
Console.WriteLine(outputText + result);
Console.ReadKey();
}
private static object Count(ref int N)
{
for (int N; N > 0; N++)
{
return (N * N++);
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题在于"int result = Count(ref …
c# ×1