asasa
asasunknown
abap
3 years ago
1.2 kB
2
Indexable
Never
int sayac = 0; int[] sayi = new int[6]; private void button1_Click(object sender, EventArgs e) { comboBox1.Items.Clear(); Random rnd = new Random(); for (int i = 0; i < sayi.Length; i++) { sayi[i] = rnd.Next(0, 50); comboBox1.Items.Add(sayi[i]); } button1.Enabled = false; button2.Enabled = true; } private void button2_Click(object sender, EventArgs e) { for (int i = 0; i < sayi.Length; i++) { if ((sayi[i] == Convert.ToInt32(textBox1.Text)) || (sayi[i] == Convert.ToInt32(textBox2.Text)) || (sayi[i] == Convert.ToInt32(textBox3.Text)) || (sayi[i] == Convert.ToInt32(textBox4.Text)) || (sayi[i] == Convert.ToInt32(textBox5.Text)) || (sayi[i] == Convert.ToInt32(textBox6.Text))) { sayac++; } MessageBox.Show(sayac + " tane sayı bildiniz."); button1.Enabled = true; button2.Enabled = false; sayac = 0; } } } }