CSharp - Write program to get value range for numeric data types

Requirements

You will display its range of possible values for each C# numeric data types.

Hint

To display the ranges, use the MinValue and MaxValue properties of all the numeric data types.

unsigned numbers usually begin with a u, meaning "unsigned."

The signed type sbyte starts with an s, meaning the "signed" variant of the much more important byte.

Demo

using System;
class Program{// w  w w .j  av  a2  s  . c  o m
    static void Main(string[] args){
        // Immediately outputs 
        Console.WriteLine("Signed whole numbers");
        Console.WriteLine("--------------------");
        Console.WriteLine("sbyte:  " + sbyte.MinValue + " to " + sbyte.MaxValue);
        Console.WriteLine("short:  " + short.MinValue + " to " + short.MaxValue);

        Console.WriteLine("int:    " + int.MinValue + " to " + int.MaxValue);
        Console.WriteLine("long:   " + long.MinValue + " to " + long.MaxValue);
        Console.WriteLine();

        Console.WriteLine("Unsigned whole numbers");
        Console.WriteLine("----------------------");
        Console.WriteLine("byte:   " + byte.MinValue + " to " + byte.MaxValue);
        Console.WriteLine("ushort: " + ushort.MinValue + " to " + ushort.
        MaxValue);
        Console.WriteLine("unit:   " + uint.MinValue + " to " + uint.MaxValue);
        Console.WriteLine("ulong:  " + ulong.MinValue + " to " + ulong.
        MaxValue);
        Console.WriteLine();

        Console.WriteLine("Basic decimal numbers");
        Console.WriteLine("---------------------");
        Console.WriteLine("float:  " + float.MinValue + " to " + float.MaxValue);
        Console.WriteLine("double: " + double.MinValue + " to " + double.
        MaxValue);
        Console.WriteLine();

        Console.WriteLine("Exact decimal numbers");
        Console.WriteLine("---------------------");
        Console.WriteLine("decimal:  " + decimal.MinValue + " to " + decimal.MaxValue);
    }
}

Result