Steve John
✅ Help with the code, please. I want my program to work properly.
for (int i = 0; i < 10; i++)
{
Console.Write("Enter a model of your car {0}:", i + 1);
modelcar[i] = Console.ReadLine();
retry:
Console.Write("Enter a year of production {0}:", i + 1);
if (int.TryParse(Console.ReadLine(), out yearcar[i]))
{
if (yearcar[i] >= 2020)
{
Console.WriteLine(" The car is new.");
}
else
{
Console.WriteLine(" The car isn't new.");
}
}
else {
Console.WriteLine(" Invalid year. Please, enter again.");
goto retry;
}
}
21 replies