- 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
C# Program to convert an Int32 value to a decimal
To convert an Int32 value to a decimal, use the Convert.ToDecimal() method.
Int32 represents a 32-bit signed integer.
Let’s say the following is our Int32 value.
int val = 2923;
Now to convert it to decimal.
decimal decVal = Convert.ToDecimal(val);
Let us see the complete example.
Example
using System; public class Demo { public static void Main() { int val = 2923; decimal decVal = Convert.ToDecimal(val); Console.WriteLine("Converted Int32 {0} to decimal {1:N2} value ", val, decVal); } }
Output
Converted Int32 2923 to decimal 2,923.00 value
Advertisements