liste sorusu

iki sayı arasından rastgele sayılar üretip 5 e kalansız bölünenleri listeye ekleme
 avatar
unknown
csharp
a year ago
547 B
9
Indexable
private void button1_Click(object sender, EventArgs e)
{
    
    int sayi1 = int.Parse(textBox1.Text);
    int sayi2 = int.Parse(textBox2.Text);
    Random rand = new Random();
    for (int i = 0; i < 10; i++)
        listBox1.Items.Add(rand.Next(sayi1, sayi2));
    
}

private void button2_Click(object sender, EventArgs e)
{
    int sayi;
    for(int i = 0;i < listBox1.Items.Count; i++)
    {
        sayi = int.Parse(listBox1.Items[i].ToString());
        if(sayi % 5 == 0)
            listBox2.Items.Add(sayi);
    }

}
Editor is loading...
Leave a Comment