public static class Program
static string random_zahl;
public static void Main()
Console.WriteLine(@"Hallo,
errate eine Zahl von 1 bis 9!
Wenn du falsch liegst, gebe ich dir einen Tipp.
ask("Welche Zahl, denkst du, ist es?");
while (answer != random_zahl);
Console.WriteLine(@"RICHTIG!
Die Zahl war " + random_zahl + @"
Du hast " + i + " Versuche gebraucht");
if (int.TryParse(answer, out a))
b = "Das ist keine Zahl";
static void ask(string question)
Console.WriteLine(question);
answer = Console.ReadLine();
static void random_generate()
Random x1 = new Random();
random_zahl = x2.ToString();
Console.WriteLine(@"This C# Programm was written by Leo Roselt