Q:

Write a program in C# Sharp to input a string and print it

0

Write a program in C# Sharp to input a string and print it. 
Test Data :
Input the string : Welcome, w3resource
Expected Output :

The string you entered is : Welcome

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;  
public class Exercise1 
{
    public static void Main()  
   {  
	    string str;	
    Console.Write("\n\nAccept a string from keyboard :\n");
    Console.Write("-----------------------------------\n"); 	
    Console.Write("Input the string : ");
    str= Console.ReadLine();
    Console.Write("The string you entered is : {0}\n", str);
	}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now