martito
martito
CC#
Created by martito on 10/5/2023 in #help
✅ Help with the code, please. I want my program to work properly.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Carriages10ModelCars
{
class Program
{
static void Main(string[] args)
{
string[] modelcar = new string [10];
int[] yearcar = new int [10];

for (int i=0; i<10; i++)

{
Console.Write ("Enter a model of your car {0}", i+1);
modelcar[i] = int.Parse(Console.ReadLine());

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.");

}

Console.WriteLine("Invalid year. Please, enter again.");
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Carriages10ModelCars
{
class Program
{
static void Main(string[] args)
{
string[] modelcar = new string [10];
int[] yearcar = new int [10];

for (int i=0; i<10; i++)

{
Console.Write ("Enter a model of your car {0}", i+1);
modelcar[i] = int.Parse(Console.ReadLine());

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.");

}

Console.WriteLine("Invalid year. Please, enter again.");
}
}
}
}
21 replies
CC#
Created by martito on 10/3/2023 in #help
✅ Carriages with 10 car models with years. If a car is produced in or after 2020 to be printed out.
Help pls ty 🙂
43 replies