
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
C# Program to Write a Number in Hexadecimal Format
Let’s say the following is the number −
int a = 12250;
You can work around the following ways to get a number in hexadecimal format −
{0:x} {0:x8} {0:X} {0:X8}
Here is the code −
Example
using System; class Demo { static void Main() { int a = 12250; Console.WriteLine("{0:x}", a); Console.WriteLine("{0:x8}", a); Console.WriteLine("{0:X}", a); Console.WriteLine("{0:X8}", a); } }
Output
2fda 00002fda 2FDA 00002FDA
Advertisements