0

Simple Game play using random by C#

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int round = 0; Console.WriteLine("Enter your name"); string name1 = Console.ReadLine(); while (round <= 5) { string[] names = new string[] { name1 }; var random = new Random(); Console.WriteLine("Enter the chess number:"); int number = Convert.ToInt32(Console.ReadLine()); var x = 0; x = random.Next(10); if (number == x) { Console.WriteLine("Winner by {0}", names); } else { Console.WriteLine("You lost man:{0}", names); Console.WriteLine("The chest number is:{0}", x); } } } } }

12th Feb 2018, 6:49 PM
Shkar ‌H Sardar
Shkar ‌H Sardar - avatar
1 Respuesta
+ 1
And what is the question?
12th Feb 2018, 6:51 PM
SQL Guy