I have highlighted the error. I can't see the issue with it. Please help!
___________________code____________________________
using System.Text;
using System.Threading.Tasks;
namespace FirstConsoleProject
{
class Program
{
static void Main(string[] args) //this is a method called Main. It is called when the program starts.
{
Start:
Console.WriteLine("Welcome to the quiz! This test has a series of questions to be answered.");
Console.WriteLine("\rGet any wrong, you have to start again.");
Console.WriteLine("\rPress enter to begin!");
Console.ReadKey();
//Question 1
Console.WriteLine("What is 10 divided by 2?"); //This is text that can be seen.
Console.ReadKey(); //This lets the player type into the console.
int answer = Convert.ToInt32(Console.ReadLine());
if (answer == 5) //Checks if the answer is correct
{
Console.WriteLine("You have answered 5, This is correct");
}
else if (answer != 5) // if it is not correct it will output this message
{
Console.WriteLine("You have answered " + answer + ", this is incorrect. Try again!");
Console.ReadKey();
goto Start; //This will send the player back to the start.
}
}
}
___________________code____________________________
using System.Text;
using System.Threading.Tasks;
namespace FirstConsoleProject
{
class Program
{
static void Main(string[] args) //this is a method called Main. It is called when the program starts.
{
Start:
Console.WriteLine("Welcome to the quiz! This test has a series of questions to be answered.");
Console.WriteLine("\rGet any wrong, you have to start again.");
Console.WriteLine("\rPress enter to begin!");
Console.ReadKey();
//Question 1
Console.WriteLine("What is 10 divided by 2?"); //This is text that can be seen.
Console.ReadKey(); //This lets the player type into the console.
int answer = Convert.ToInt32(Console.ReadLine());
if (answer == 5) //Checks if the answer is correct
{
Console.WriteLine("You have answered 5, This is correct");
}
else if (answer != 5) // if it is not correct it will output this message
{
Console.WriteLine("You have answered " + answer + ", this is incorrect. Try again!");
Console.ReadKey();
goto Start; //This will send the player back to the start.
}
}
}