c# |
private void button1_Click(object sender, EventArgs e)
{
{
Random r ;
r=new Random () ;
int a ,adet1=0,adet2=0,adet3=0 ;
for (int i = 1; i <= 20; i++)
{
a = r.Next(0, 999);
if (a>=0 && a < 10)
{
listBox1.Items.Add(a);
adet1 = adet1 + 1;
}
else if (a>= 10 && a<100)
{
listBox2.Items.Add(a);
adet2++;
}
else if (a>= 100 && a<=999)
{
listBox3.Items.Add(a);
adet3++;
}
}
label1.Text = adet1.ToString();
label2.Text = adet2.ToString();
label3.Text = adet3.ToString();
}
0 yorum :
Yorum Gönder