startit/Emne 3/ConsoleApp5/Random/Program.cs

27 lines
724 B
C#
Raw Permalink Normal View History

2024-11-14 14:08:38 +01:00
using System;
namespace Random
{
2024-11-14 14:17:34 +01:00
class RandomHobby
2024-11-14 14:08:38 +01:00
{
static void Main(string[] args)
{
System.Random rnd = new System.Random();
int randomnr = rnd.Next(0, 3);
2024-11-14 14:17:34 +01:00
Console.WriteLine("Hvem trenger en ny hobby? ");
string name = Console.ReadLine();
2024-11-14 14:08:38 +01:00
if (randomnr == 0)
{
2024-11-14 14:17:34 +01:00
Console.WriteLine($"{name} har nå hobbyen å strikke");
2024-11-14 14:08:38 +01:00
}else if (randomnr == 1)
{
2024-11-14 14:17:34 +01:00
Console.WriteLine($"{name} er nå glad i å tegne");
2024-11-14 14:08:38 +01:00
}
else
{
2024-11-14 14:17:34 +01:00
Console.WriteLine($"{name} driver nå med Texas Hold-em");
2024-11-14 14:08:38 +01:00
}
}
}
}