CSharp - Write program to get how many bytes of memory each type uses

Requirements

You will write a program that tells you how many bytes of memory each type uses.

Hint

Use sizeof operator to get the memory consumption of each type.

Demo

using System;
class Program{//  ww  w. jav a 2 s  .  c  om
    static void Main(string[] args){
        // Outputs 
        Console.WriteLine("Whole numbers");
        Console.WriteLine("byte:   " + sizeof(byte));
        Console.WriteLine("sbyte:  " + sizeof(sbyte));
        Console.WriteLine();
        Console.WriteLine("short:  " + sizeof(short));
        Console.WriteLine("ushort: " + sizeof(ushort));
        Console.WriteLine();
        Console.WriteLine("int:    " + sizeof(int));
        Console.WriteLine("uint:   " + sizeof(uint));
        Console.WriteLine();
        Console.WriteLine("long:   " + sizeof(long));
        Console.WriteLine("ulong:  " + sizeof(ulong));
        Console.WriteLine();
        Console.WriteLine("Decimal numbers");
        Console.WriteLine("float:    " + sizeof(float));
        Console.WriteLine("double:   " + sizeof(double));
        Console.WriteLine("decimal:  " + sizeof(decimal));
        Console.WriteLine();
    }
}

Result