A Simple Interactive Program

This lesson will discuss using command line to pass input to a program in C#

We'll cover the following

Accepting Command-Line Input

In the example, in the previous lesson you simply ran the program and it produced an output. However, many programs are written to accept command-line input.

Down below is an example of a more interactive sample program which takes input using the command line.

In this example, you’ll be required to enter your name which will then be displayed when you run the code.

Note: Before you run the code, click on the >_STDIN button present beside the RUN button in the code widget. Write your name in the input bar that appears and then click RUN button to see the output.

Get hands-on with 1400+ tech skills courses.