Friday 4 July 2014

Write C# code to prompt a user to input his/her name and then the output will be shown as an example below:

Hello GEORGE!
Solution:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Csharp_exercises
{
class Program
{
static void Main(string[] args)
   {

  string name;
  Console.Write("Please enter your name:");
  name = Console.ReadLine();
 
  Console.WriteLine("Hello {0}!", name);
  Console.ReadLine();
 
         }
   }
}

1 comment: