Echo some stats : Console « Development Class « C# / C Sharp






Echo some stats

   

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

class Program {
    static void Main(string[] args) {
        Console.Write("Enter your name: ");
        string s;
        s = Console.ReadLine();
        Console.WriteLine("Hello, {0} ", s);
        Console.Write("Enter your age: ");
        s = Console.ReadLine();
        Console.WriteLine("You are {0} years old", s);

    }
}

   
    
  








Related examples in the same category

1.Read a line of string and check its length
2.WriteLine and Write
3.Printing one line of text with multiple statements.
4.Printing multiple lines with a single statement.
5.Printing multiple lines of text with string formatting.
6.Displaying the sum of two numbers input from the keyboard.
7.Change console foreground color and background colorChange console foreground color and background color
8.Clear consoleClear console
9.Set console: title, window size, buffer height and width, cursor positionSet console: title, window size, buffer height and width, cursor position
10.CursorVisible ResetColor SetWindowSize BufferHeight BufferWidth CursorLeft CursorSize CursorTop
11.Use Red and Green from ConsoleColor
12.Beep
13.Beep(200, 300)
14.Use format specifiers with Console.WriteLine
15.Console Output Util
16.If the console moves, Pause.