Saturday, 25 May 2013

C# Min and Max Value of a data Type


Min and Max Value of a Data Type

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 

namespace datatypeproperties

{

    class Program

    {

        static void Main(string[] args)

        {

            int a;

            long b;

            b = 12345678908907654;

            if (b > int.MinValue && b < int.MaxValue)

            {

                a = (int)b;

                Console.WriteLine(a);

            }

            else

                Console.WriteLine("Overflow");

 

            Console.WriteLine("Double "+double.MinValue+" "+Double.MaxValue);

            Console.WriteLine("Byte " + byte.MinValue + " " + Byte.MaxValue);

        }

    }

}

No comments:

Post a Comment