C#阶乘问题计算阶乘.比如用户在TextBox里输入7,就会显示 :The factorial of 1 is 1The factorial of 2 is 2The factorial of 3 is 6The factorial of 4 is 24The factorial of 5 is 120The factorial of 6 is 720The factorial of 7 is 5040.这

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/02 02:22:02
C#阶乘问题计算阶乘.比如用户在TextBox里输入7,就会显示 :The factorial of 1 is 1The factorial of 2 is 2The factorial of 3 is 6The factorial of 4 is 24The factorial of 5 is 120The factorial of 6 is 720The factorial of 7 is 5040.这
xn@_Jlr~HE XC({d;p?zdWpfa63BjiB \BBʋ (v/bhRRh,9e>5=St/EDҽc,f&ݍ'DP?fçr$qHۉw6I[D.C*EVyf [d`:TrK' Zf`tCehaRFzČ_?@5ҲL&eӏ ( n&jq+l *_m p$~=N_W$ @CT GB&N\Q*`+I%V|/x_v;i|ό3v D8rgos[[u#7c=rֶThL

C#阶乘问题计算阶乘.比如用户在TextBox里输入7,就会显示 :The factorial of 1 is 1The factorial of 2 is 2The factorial of 3 is 6The factorial of 4 is 24The factorial of 5 is 120The factorial of 6 is 720The factorial of 7 is 5040.这
C#阶乘问题
计算阶乘.比如用户在TextBox里输入7,就会显示 :
The factorial of 1 is 1
The factorial of 2 is 2
The factorial of 3 is 6
The factorial of 4 is 24
The factorial of 5 is 120
The factorial of 6 is 720
The factorial of 7 is 5040
.
这是我的代码,这是乘方,怎么写阶乘?
//Declare variables
int numRow =0;
int i = 0;
public calculateButton()
{
InitializeComponent();
}
private void buttonCalculate_Click(object sender,EventArgs e)
{
if (int.TryParse(textBoxnumber.Text,out numRow) == true)
{
for (int i = 1; i

C#阶乘问题计算阶乘.比如用户在TextBox里输入7,就会显示 :The factorial of 1 is 1The factorial of 2 is 2The factorial of 3 is 6The factorial of 4 is 24The factorial of 5 is 120The factorial of 6 is 720The factorial of 7 is 5040.这
在最前面加:
double sum = 1;

int i = 0;一起


for语句内修改:
for (int i = 1; i