CursorVisible ResetColor SetWindowSize BufferHeight BufferWidth CursorLeft CursorSize CursorTop

image_pdfimage_print
   
 

using System;

public class MainClass
{
    static void Main(string[] args) {
       // Change the console appearance and redisplay.
       Console.Title = "Resized Console";
       Console.ResetColor();
       Console.Clear();
       Console.SetWindowSize(100, 50);
       Console.BufferHeight = 500;
       Console.BufferWidth = 100;
       Console.CursorLeft = 20;
       Console.CursorSize = 50;
       Console.CursorTop = 20;
       Console.CursorVisible = false;
   }
}

    


CursorVisible ResetColor SetWindowSize BufferHeight BufferWidth CursorLeft CursorSize CursorTop

image_pdfimage_print
   
 

using System;

public class MainClass
{
    static void Main(string[] args) {
       // Change the console appearance and redisplay.
       Console.Title = "Resized Console";
       Console.ResetColor();
       Console.Clear();
       Console.SetWindowSize(100, 50);
       Console.BufferHeight = 500;
       Console.BufferWidth = 100;
       Console.CursorLeft = 20;
       Console.CursorSize = 50;
       Console.CursorTop = 20;
       Console.CursorVisible = false;
   }
}

    


Displaying the sum of two numbers input from the keyboard.

image_pdfimage_print
   


using System;

public class Addition
{
   public static void Main( string[] args )
   {
      int number1; 
      int number2; 
      int sum; 

      Console.Write( "Enter first integer: " ); 
      number1 = Convert.ToInt32( Console.ReadLine() );

      Console.Write( "Enter second integer: " );
      number2 = Convert.ToInt32( Console.ReadLine() );

      sum = number1 + number2;

      Console.WriteLine( "Sum is {0}", sum );
   } 
}


           
          


WriteLine and Write

image_pdfimage_print
   
 


using System;

class ConsoleAdder {
    public static void Main() {
        int a = 15;
        int b = 744;
        int c = a + b;

        Console.Write("The sum of ");
        Console.Write(a);
        Console.Write(" and ");
        Console.Write(b);
        Console.Write(" equals ");
        Console.WriteLine(c);
        Console.WriteLine("The sum of " + a + " and " + b + " equals " + c);
        Console.WriteLine("The sum of {0} and {1} equals {2}", a, b, c);
    }
}