38
1
using System;
2
3
public class Program
4
{
5
public static void Main()
6
{
7
int[] getal = new int[5];
8
String uitvoer = "";
9
Int32 positie;
10
Random Willekeurig = new Random();
11
12
for (int x = 0; x <= getal.GetUpperBound(0); x++)
13
{
14
getal[x] = Willekeurig.Next(1, 7);
15
}
16
17
Array.Sort(getal);
18
19
for (int y = 0; y <= getal.GetUpperBound(0); y++)
20
{
21
uitvoer += Convert.ToString(getal[y]) + Environment.NewLine;
22
}
23
24
positie = Array.IndexOf(getal, 6);
25
26
if (positie != -1)
27
{
28
uitvoer += Environment.NewLine + "Het getal 6 staat op positie " + (positie + 1) + ".";
29
}
30
else
31
{
32
uitvoer += Environment.NewLine + "Het getal 6 komt niet voor!";
33
}
34
35
36
Console.WriteLine(uitvoer);
37
}
38
}
Cached Result