
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Decimal constants in C#
Decimal type has constants to get the minimum and maximum values.
Set a decimal value −
decimal d = 5.8M;
To get the minimum and maximum values of the decimal type, use the following properties −
decimal.MaxValue decimal.MinValue
Here is the complete code −
Example
using System; using System.Linq; class Demo { static void Main() { decimal d = 5.8M; Console.WriteLine(d); Console.WriteLine("Maximum Value: "+decimal.MaxValue); Console.WriteLine("Maximum Value: "+decimal.MinValue); } }
Output
5.8 Maximum Value: 79228162514264337593543950335 Maximum Value: -79228162514264337593543950335
- Related Questions & Answers
- C# TicksPer constants
- Difference between C++ string constants and character constants
- What are constants in C++?
- How to define constants in C++?
- What are Enumerated Constants in C++?
- What are C++ Integer Constants?
- What are C++ Character Constants?
- PHP Constants
- How to define character constants in C#?
- Character constants vs String literals in C#
- What are C++ Floating-Point Constants?
- Data type of character constants in C and C++
- Decimal type in C#
- Decimal Functions in C#
- Decimal Struct in C#
Advertisements