Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Random number guessing game v1
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { START: Random rnd = new Random(); int random = rnd.Next(1, 5); Console.WriteLine("Pick a ramdom number between 1 - 5."); string userValue = Console.ReadLine(); if (userValue == random.ToString()) { Console.WriteLine("You guessed right!"); Console.ReadLine(); goto START; } else { Console.WriteLine("You entered {0} ", userValue); Console.ReadLine(); goto START; } } } }
run
|
edit
|
history
|
help
0
Method overriding
ds
Random name switch
kod 1
Project01
My Test
all possible sub strings of a given string
BankAccount
operatoru
Linq FirstOrDefault() null check in c#