using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { { for (int i = 1; i <= (Convert.ToInt32(textBox1.Text)); i++) { if (i % 2 == 1) { lstBox1.Items.Add(i); } { int toplam = 0; for (int j = 0; j < lstBox1.Items.Count; j++) { toplam += Convert.ToInt32(lstBox1.Items[j]); } TekSayi.Text = toplam.ToString(); } } } { for (int a = 1; a <= (Convert.ToInt32(textBox1.Text)); a++) { if (a % 2 == 0) { lstBox2.Items.Add(a); } { int toplamcift = 0; for (int k = 0; k < lstBox2.Items.Count; k++) { toplamcift += Convert.ToInt32(lstBox2.Items[k]); } CiftSayi.Text = toplamcift.ToString(); } } } } private void button2_Click(object sender, EventArgs e) { } } }