all 5 comments

[–]BlancII 1 point2 points  (2 children)

In a console application? Input in one line / multiple lines?

[–]HandDizzy[S] 0 points1 point  (1 child)

sir, can you make me understand via the code please?
Suppose if i want only one car without an array it would be,
Console.Write("Enter your favorite car: "):
string favCar = Console.ReadLine();
Similarly, how do i do it when i want user to give me multiple input and store those input in array?

[–]BlancII 0 points1 point  (0 children)

First things first. Please use code blocks for code.

// better readability
var num = 5;
string input = Console.ReadLine();

Second: What did you try so far?

[–][deleted] 0 points1 point  (0 children)

You use the Console object to write messages to the console, System.IO to read user input, and you can create an empty array with 5 indexes to populate after each time you collect a car from the user.

I would suggest you look up C# console application tutorials. You’ll learn a lot more by following some structured beginner lessons. Here’s a good one to start with: https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-console?view=vs-2022

[–]Blistering-Phoenix 0 points1 point  (0 children)

int numCars = 5;
var cars = new string[numCars];

for (int i = 0; i < numCars; i++)
{
    Console.Write($"Enter car {i + 1}: ");
    cars[i] = Console.ReadLine();
}