C# Program to print Range of all Data Types

Notes:

C# Program to print Range of all Data Types:

using System;

namespace RangeofAllTypesDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("byte min = " + byte.MinValue); // 0
Console.WriteLine("byte max = " + byte.MaxValue); // 255
Console.WriteLine();
Console.WriteLine("sbyte min = " + sbyte.MinValue); // -128
Console.WriteLine("sbyte max = " + sbyte.MaxValue); // 127
Console.WriteLine();
Console.WriteLine("ushort min = " + ushort.MinValue); // 0
Console.WriteLine("ushort max = " + ushort.MaxValue); // 65535
Console.WriteLine();
Console.WriteLine("short min = " + short.MinValue); // -32768
Console.WriteLine("short max = " + short.MaxValue); // 32767
Console.WriteLine();
Console.WriteLine("uint min = " + uint.MinValue); // 0
Console.WriteLine("uint max = " + uint.MaxValue); // 4,294,967,295
Console.WriteLine();
Console.WriteLine("int min = " + int.MinValue); // -2147483648
Console.WriteLine("int max = " + int.MaxValue); // 2147483647
Console.WriteLine();
Console.WriteLine("ulong min = " + ulong.MinValue); // 0
Console.WriteLine("ulong max = " + ulong.MaxValue); // 18,446,744,073,709,551,615
Console.WriteLine();
Console.WriteLine("long min = " + long.MinValue); // -9,223,372,036,854,775,808
Console.WriteLine("long max = " + long.MaxValue); // 9,223,372,036,854,775,807
Console.WriteLine();
Console.WriteLine("float min = " + float.MinValue); // -3.4E+38
Console.WriteLine("float max = " + float.MaxValue); // 3.4E+38
Console.WriteLine();
Console.WriteLine("double min = " + double.MinValue); // -1.7E+308
Console.WriteLine("double max = " + double.MaxValue); // 1.7E+308
Console.WriteLine();
Console.WriteLine("decimal min = " + decimal.MinValue); // -7.9E+28
Console.WriteLine("decimal max = " + decimal.MaxValue); // 7.9E+28
Console.ReadKey();
}
}
}