Monday, 28 July 2014

How to Reading and Writing to Console in Csharp

Interactive Programs in Csharp

Writing and Reading in Console Window

Console.ReadLine();

Console.WriteLine();


   
    
using System;
public class Hello1
{
    public static void Main(String[] args)

    {
        // This is For Printing a message in Console.
        Console.WriteLine("How to Read and Write to Console ");


        // This is For Reading a string (Text) from user given as input as FirstName
        string Firstname = Console.ReadLine();

        // This is For Printing FirstName in Console.
        Console.WriteLine("user Entered First Name: {0}",Firstname );

        // This is For Reading a string (Text) from user given as input as LastName
        string Lastname = Console.ReadLine();
        // This is For Printing LastName in Console.
        Console.WriteLine("user Entered LastName: {0}",Lastname);
        Console.ReadLine();
    }    
 

Output

How to Reading and Writing to Console in Csharp

 



No comments:

Post a Comment