Programalama > C#

Etiketler: sayisal, loto, programi

Ort. 5
Puan ver:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int sayi;
            int m=0;
            listBox1.Items.Clear();
            Random rasgele=new Random();
            ArrayList dizi=new ArrayList();
            int[] loto=new int[6];
            int deger;
            for (int i=0;i<=48;i++)
            {
                dizi.Add(i+1);
            }
            for (int i=0;i<=5;i++)
            {
                deger=rasgele.Next()%dizi.Count+1;
                loto[i]=Convert.ToInt32(dizi[deger-1]);
                dizi.RemoveAt(deger-1);
            }
             
            for (int j=0;j<=5;j++)
            {
                for (int k=j+1;k<=5;k++)
                {
                    if ( loto[j]>loto[k])
                    {
                        sayi=loto[j];
                        loto[j]=loto[k];
                        loto[k]=sayi;
                    }
                    m++;
                }
            }
            foreach (int eleman in loto)
            {
                listBox1.Items.Add(eleman);
            }
            this.Text=m.ToString();


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2025 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.