DigitalOrgano

  • Home
  • About
  • Categories
    • Windows OS
    • Software
    • Android
    • Technology
  • Contact
DigitalOrgano » Technology » C++ Program To Convert Decimal To Hexadecimal

C++ Program To Convert Decimal To Hexadecimal

Last updated on June 22, 2020 by Editorial Staff Under Technology

Tweet
Share
Share
Pin

If you know what is hexadecimal or hex, you would definitely know what this articles is all about. If you don’t, you might want to check the below table.

Cpp-Program-To-Convert-Decimal-To-Hexadecimal-1

Still confuse? Click Here

So let get started

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
    int input;
    cout<<"Enter a Decimal Number: ";
    cin>>input;
    cout<<"Hexadecimal: "<<hex<<input; //conversion
    getch();
    return 0;
}

Explanation

When the program run, it will ask for decimal digit and convert it into hexadecimal.

In C++, there is no need to write a complex program in order to convert decimal to hex. There is a keyword called hex which automatically convert the input number into hex. We use this keyword in the conversion line which convert the output number into hex.

Output

Cpp-Program-To-Convert-Decimal-To-Hexadecimal-2

« Remove Unused Items From Right Click Send To List
C++ Program To Find Prime Number »

Our Social Links

  • facebook
  • instagram
  • feedburner

Latest Articles

  • Create Shortcut For Any Program Or Folder In My Computer
  • The Best Way To Post Story On Instagram Using PC
  • Download Latest Google Chrome Offline Installer
  • 5 Best Ways to Free Up Drive Space on Windows 10
  • How to Enable Dark Mode in Microsoft Office
  • How to Properly Restore Windows Registry in Windows 10
Copyright © 2025 DigitalOrgano