100 674
Assignments Done
98.3%
Successfully Done
In July 2021

# Answer to Question #4646 in C# for richard rooks

Question #4646
how do you create a program that first asks for two integer values A and B. Your program should
then pick a random number between A and B and keep it secret. Then ask the user to
guess what the number is. The program should continue to ask the user to guess, until
the user gets the correct answer. Each time the user makes an incorrect guess, the
program should tell the user if the guess was too high, or too low. The program should
also tell the user if the guess was outside the range between A and B.
1
2011-10-13T13:11:24-0400
using System;
using System.Collections.Generic;
using
System.Linq;
using System.Text;

namespace questions_CSharp
{

class Program
{
& static void Main(string[] args)
&
{
int A = 0, B = 0, C = 0, userNumber = 0;
Random
rand = new Random();
");

B =
C = rand.Next(A,
B);
Console.WriteLine("Secret Number is
generated!");
Console.WriteLine("Try to guess
it!");
while (true)
{

userNumber =

if (userNumber == C)

{
& Console.WriteLine("Congratulations!
& break;

}
if (userNumber < A || userNumber > B)
Console.WriteLine("Number is outside the range between A and B. Try
Again!");
if (userNumber < C) Console.WriteLine("Number is
to low");
if (userNumber > C) Console.WriteLine("Number is
to high");
}
Console.WriteLine("Have a nive day.
To exit press any button...");
&
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!