Write a C# program to accept a string from keyboard and print it

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
public class StringExercise
{
    public static void Main()
    {
        string str;
 
        Console.Write("Enter the string : ");
        str = Console.ReadLine();
        Console.Write("The string you entered is : {0}\n", str);
 
        Console.ReadLine();
    }
}

Result

Write a C# program to accept a string from keyboard and print it
Write a C# program to accept a string from keyboard and print it

Leave a Comment

x