- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 Functions in C#
The following are some of the decimal functions in C#.
Sr.No. | Name & Description |
---|---|
1 | Add (Decimal, Decimal) Adds two specified Decimal values. |
2 | Ceiling(Decimal) Returns the smallest integral value that is greater than or equal to the specified decimal number. |
3 | Compare (Decimal, Decimal) Compares two specified Decimal values. |
4 | CompareTo(Decimal) Compares this instance to a specified Decimal object and returns a comparison of their relative values. |
5 | CompareTo(Object) Compares this instance to a specified object and returns a comparison of their relative values. |
6 | Divide (Decimal, Decimal) Divides two specified Decimal values. |
7 | Equals(Decimal) Returns a value indicating whether this instance and a specified Decimal object represent the same value. |
Let us see an example of Decimal Ceiling() method in C# that returns the smallest integral value greater than or equal to the specified decimal number.
Example
using System; class Program { static void Main() { Console.WriteLine(decimal.Ceiling(1.2M)); } }
Output
2
Advertisements