© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
20 replies
martito

✅ 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.");
    }
}
    }
} 
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Help with my program please!
C#CC# / help
3y ago
I need help with my program
C#CC# / help
4y ago
Please, help me with program logic
C#CC# / help
2y ago
I NEED HELP WITH MY CODE
C#CC# / help
2y ago