using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication17
{
class Program
{
static void Main(string[] args)
{
while (true)
{
int rdmNum = snt(1, 51);
int count = 1;
while (true)
{
Console.Write("Please put a numerical value here between 1 and 50(0 to quit):");
int input = Convert.ToInt32(Console.ReadLine());
if (input == 0)
return;
else if (input < rdmNum)
{
Console.WriteLine("Sorry, This value is Low \nPlease try again...");
++count;
continue;
}
else if (input > rdmNum)
{
Console.WriteLine("Sorry, This value is High \nPlease try again.");
++count;
continue;
}
else
{
Console.WriteLine("Hi, You guessed this! The number was {0}!", rdmNum);
Console.WriteLine("It found you {0} {1}.\n", count, count == 1 ? "try" : "tries");
break;
}
}
}
}
static int snt(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
}
}
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Can you answer this question?
Write Answer1 Answers