1.7.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 13 行
TXT
13 行
Listing 1.7 Using a for Statement to Loop and Calculate the Factorial of a Number
static void ComputeFactorial()
{
ulong loopCount = 0;
ulong factorial = 1;
Console.Write( “Enter an integer between 1 and 50: “ );
loopCount = UInt64.Parse( Console.ReadLine() );
for( ulong i = loopCount; i > 0; i-- )
{
factorial *= i;
}
Console.WriteLine( “{0}! = {1}”, loopCount, factorial );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?