textbox1 ile textbox2 ye girilen degerlerin arasındaki sayıların toplamını bulan program C#

textbox1 ile textbox2 ye girilen degerlerin arasındaki sayıların toplamını bulan program C#

[code lang=”csharp”]

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace iki_textbox_arasi_toplam

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

int toplam=0;

for (int i = int.Parse(textBox1.Text); i <= int.Parse(textBox2.Text); i++)

{

toplam += i;

}

label2.Text = toplam.ToString();

}

}

}

[/code]

Dosyayı İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir