= 1; --i) for (i = 1 ; i <= iSutja; ++i) { dSum = dSum + i; //textBox2.AppendText(i + " + "); textBox2.Text = i + " + " + textBox2.Text; } textBox2.Text = textBox2.Text.Substring(0, textBox2.TextLength - 2); //textBox2.AppendText(" = " + dSum); textBox2.Text = dSum + " = " + textBox2.Text; }"> = 1; --i) for (i = 1 ; i <= iSutja; ++i) { dSum = dSum + i; //textBox2.AppendText(i + " + "); textBox2.Text = i + " + " + textBox2.Text; } textBox2.Text = textBox2.Text.Substring(0, textBox2.TextLength - 2); //textBox2.AppendText(" = " + dSum); textBox2.Text = dSum + " = " + textBox2.Text; }"> = 1; --i) for (i = 1 ; i <= iSutja; ++i) { dSum = dSum + i; //textBox2.AppendText(i + " + "); textBox2.Text = i + " + " + textBox2.Text; } textBox2.Text = textBox2.Text.Substring(0, textBox2.TextLength - 2); //textBox2.AppendText(" = " + dSum); textBox2.Text = dSum + " = " + textBox2.Text; }">
private void button1_Click(object sender, EventArgs e)
{
int iSutja; //N 값을 입력받을 변수
int i;
Double dSum = 0; // 합계를 담을 변수선언
iSutja = int.Parse(textBox1.Text);
textBox2.Text = "";
//for (i = iSutja; i >= 1; --i)
for (i = 1 ; i <= iSutja; ++i)
{
dSum = dSum + i;
//textBox2.AppendText(i + " + ");
textBox2.Text = i + " + " + textBox2.Text;
}
textBox2.Text = textBox2.Text.Substring(0, textBox2.TextLength - 2);
//textBox2.AppendText(" = " + dSum);
textBox2.Text = dSum + " = " + textBox2.Text;
}