

- 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
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
- Related Questions & Answers
- How to format hexadecimal Number in JavaScript?
- Parse and format to hexadecimal in Java
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- C++ Program to Convert Hexadecimal Number to Binary
- Convert a Number to Hexadecimal in C++
- Java Program to convert decimal integer to hexadecimal number
- Hexadecimal Number System
- C program to write an image in PGM format
- Write a Golang program to reverse a number
- C# Hexadecimal ("X") Format Specifier
- How to Convert a String to Hexadecimal and vice versa format in java?
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- Count Hexadecimal Number in C++
- Write a python program to count total bits in a number?
Advertisements