C# Sayısal Loto Programı

Csharp Sayısal Loto Programı

C# Sayısal Loto Programı. 0-49 arasında rastgele 6 adet tam sayı üreterek ekrana yazdıran program

Program Kodları:
Formun üst kısmında bulunan butona aşağıdaki kodları yazınız.

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random sayi = new Random();
            int[] rastgele = new int[6];
            for (int i = 0; i < 6; i++)
            {
                rastgele[i] = sayi.Next(1, 50);
            }
            //Numaraları sıralıyoruz
            Array.Sort(rastgele);

            for (int i = 0; i < 6; i++)
            {
                listBox1.Items.Add(rastgele[i]);
            }

        }
    }
}

Ekran Görüntüsü

Bu Yazıya Tepkin Nedir?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
2

Yorum Yap