uppgift 1
using System;
using System.Collections.Generic;
using System.Text;
namespace Project1
{
class uppgift1
{
public static void Main(String[] arg)
{
Random r = new Random();
int[] i = new int[100];
int[] j = new int[7];
for (int a = 0; a < 100; a++)
{
i[a] = r.Next(6) + 1;
j[i[a]]++;
}
for (int a = 1; a < 7; a++)
{
Console.WriteLine("Antal " + a + "or "+j[a]);
}
Console.WriteLine();
Console.Write("Välj ett nummer (1 - 100) ");
int nummer = int.Parse(Console.ReadLine());
Console.WriteLine("Det " + nummer + ":e nummret gav en " + i[nummer] + ":a");
}
}
}
using System.Collections.Generic;
using System.Text;
namespace Project1
{
class uppgift1
{
public static void Main(String[] arg)
{
Random r = new Random();
int[] i = new int[100];
int[] j = new int[7];
for (int a = 0; a < 100; a++)
{
i[a] = r.Next(6) + 1;
j[i[a]]++;
}
for (int a = 1; a < 7; a++)
{
Console.WriteLine("Antal " + a + "or "+j[a]);
}
Console.WriteLine();
Console.Write("Välj ett nummer (1 - 100) ");
int nummer = int.Parse(Console.ReadLine());
Console.WriteLine("Det " + nummer + ":e nummret gav en " + i[nummer] + ":a");
}
}
}
Kommentarer
Trackback