mystery_xD
New member
- Joined
- Dec 7, 2021
- Messages
- 1
- Programming Experience
- Beginner
Been trying to make this work, no idea what to do.
Heres my code.
Heres my code.
C#:
using System;
namespace numbers
{
class Program
{
static void Main(string[] args)
{
int num = random.Next(1,1000);
Console.Write("Welcome! I have chosen a number between 1 and 1000. Want to take a guess? ");
int guess = Convert.ToInt32(Console.Read());
if (guess < num)
{
Console.Write("My number is lower.");
}
else if (guess > num)
{
Console.Write("My number is higher");
}
else if (guess == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess2 = Convert.ToInt32(Console.Read());
if (guess2 < num)
{
Console.Write("My number is lower.");
}
else if (guess2 > num)
{
Console.Write("My number is higher");
}
else if (guess2 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess3 = Convert.ToInt32(Console.Read());
if (guess3 < num)
{
Console.Write("My number is lower.");
}
else if (guess3 > num)
{
Console.Write("My number is higher");
}
else if (guess3 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess4 = Convert.ToInt32(Console.Read());
if (guess4 < num)
{
Console.Write("My number is lower.");
}
else if (guess4 > num)
{
Console.Write("My number is higher");
}
else if (guess4 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess5 = Convert.ToInt32(Console.Read());
if (guess5 < num)
{
Console.Write("My number is lower.");
}
else if (guess5 > num)
{
Console.Write("My number is higher");
}
else if (guess5 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess6 = Convert.ToInt32(Console.Read());
if (guess6 < num)
{
Console.Write("My number is lower.");
}
else if (guess6 > num)
{
Console.Write("My number is higher");
}
else if (guess6 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess7 = Convert.ToInt32(Console.Read());
if (guess7 < num)
{
Console.Write("My number is lower.");
}
else if (guess7 > num)
{
Console.Write("My number is higher");
}
else if (guess7 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess8 = Convert.ToInt32(Console.Read());
if (guess8 < num)
{
Console.Write("My number is lower.");
}
else if (guess8 > num)
{
Console.Write("My number is higher");
}
else if (guess8 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess9 = Convert.ToInt32(Console.Read());
if (guess9 < num)
{
Console.Write("My number is lower.");
}
else if (guess9 > num)
{
Console.Write("My number is higher");
}
else if (guess9 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess10 = Convert.ToInt32(Console.Read());
if (guess10 < num)
{
Console.Write("My number is lower.");
}
else if (guess10 > num)
{
Console.Write("My number is higher");
}
else if (guess10 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess11 = Convert.ToInt32(Console.Read());
if (guess11 < num)
{
Console.Write("My number is lower.");
}
else if (guess11 > num)
{
Console.Write("My number is higher");
}
else if (guess11 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess12 = Convert.ToInt32(Console.Read());
if (guess12 < num)
{
Console.Write("My number is lower.");
}
else if (guess12 > num)
{
Console.Write("My number is higher");
}
else if (guess12 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess13 = Convert.ToInt32(Console.Read());
if (guess13 < num)
{
Console.Write("My number is lower.");
}
else if (guess13 > num)
{
Console.Write("My number is higher");
}
else if (guess13 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess14 = Convert.ToInt32(Console.Read());
if (guess14 < num)
{
Console.Write("My number is lower.");
}
else if (guess14 > num)
{
Console.Write("My number is higher");
}
else if (guess14 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess15 = Convert.ToInt32(Console.Read());
if (guess15 < num)
{
Console.Write("My number is lower.");
}
else if (guess15 > num)
{
Console.Write("My number is higher");
}
else if (guess15 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess16 = Convert.ToInt32(Console.Read());
if (guess16 < num)
{
Console.Write("My number is lower.");
}
else if (guess16 > num)
{
Console.Write("My number is higher");
}
else if (guess16 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess17 = Convert.ToInt32(Console.Read());
if (guess17 < num)
{
Console.Write("My number is lower.");
}
else if (guess17 > num)
{
Console.Write("My number is higher");
}
else if (guess17 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess18 = Convert.ToInt32(Console.Read());
if (guess18 < num)
{
Console.Write("My number is lower.");
}
else if (guess18 > num)
{
Console.Write("My number is higher");
}
else if (guess18 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess19 = Convert.ToInt32(Console.Read());
if (guess19 < num)
{
Console.Write("My number is lower.");
}
else if (guess19 > num)
{
Console.Write("My number is higher");
}
else if (guess19 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
int guess20 = Convert.ToInt32(Console.Read());
if (guess20 < num)
{
Console.Write("My number is lower.");
}
else if (guess20 > num)
{
Console.Write("My number is higher");
}
else if (guess20 == num)
{
Console.Write("You guessed my number! It was " + num + "!");
}
}
}
}
Last edited by a moderator: