
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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 Articles
- Difference between C++ string constants and character constants
- Mathematical Constants in Python
- Constants in Rust Programming
- Explain Constants in ES6
- PHP Constants
- Are there constants in JavaScript?
- What are constants in C++?
- PHP Class Constants
- C# TicksPer constants
- Using constants in ABAP OO method
- How to define constants in C++?
- What are Enumerated Constants in C++?
- Display File class constants in Java
- How to implement constants in java?
- PHP Predefined Mathematical Constants

Advertisements