namespace WinFormsApp14
{
public partial class txTong : Form
{
public txTong()
{
InitializeComponent();
}
Form1_Load( sender, EventArgs e)private void object
{
}
txtN_TextChanged( sender, EventArgs e)private void object
{
}
txttinh_Click( sender, EventArgs e)private void object
{
text = txtN.Text;string
n = int int.Parse(text);
s = 0;long
( i = 0; i < n; i++) for int
{
s = s + i;
}
txttong.Text=s.ToString();
}
txtthoat_Click( sender, EventArgs e)private void object
{
this.Close();
}
}
}

Preview text:

namespace WinFormsApp14 {
public partial class txTong : Form { public txTong() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { }
private void txtN_TextChanged(object sender, EventArgs e) { }
private void txttinh_Click(object sender, EventArgs e) { string text = txtN.Text; int n = int.Parse(text); long s = 0;
for (int i = 0; i < n; i++) { s = s + i; } txttong.Text=s.ToString(); }
private void txtthoat_Click(object sender, EventArgs e) { this.Close(); } } }