Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

Declare decimal variable

decimal is intended for use in monetary calculations. decimal utilizes 128 bits to represent values within the range 1E-28 to 7.9E+28. decimal eliminates the rounding errors caused by the normal floating-point data type. using System; using System.Collections.Generic; using System.Text; class MainClass {     static void Main(string[] args)     {         decimal myDecimal = 150;         double myDouble = 150;     } }