C# 编写程序,求p=1*3*5*...*(2n-1)的值

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 14:14:18
C# 编写程序,求p=1*3*5*...*(2n-1)的值

C# 编写程序,求p=1*3*5*...*(2n-1)的值
C# 编写程序,求p=1*3*5*...*(2n-1)的值

C# 编写程序,求p=1*3*5*...*(2n-1)的值
Console.Write("请输入n=");
int n=Convert.ToInt32(Console.ReadLine());
int sum=0;
for(int i = 1; i < 2 * n - 1; i += 2)
{
sum *= i;
}
Console.WriteLine("p={0}", sum);
Console.ReadKey();

搞定