C# code to display user entered input

Practical : 6
Subject : .NET
Aim : Write C# code to prompt a user to input his/her name and country name and then the output will be shown as an example below:
Hello Ram from country India!



Code:

using System;
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Enter your name:");
        String name = Console.ReadLine();
        Console.WriteLine("Enter your country name:");
        String country = Console.ReadLine();
        Console.WriteLine("Hello {0} from country {1}!",name,country);
    Console.ReadKey();
    }
}


Output:

Previous
Next Post »

Ads