How to display number in hexadecimal form in C++ Program

CWC
0 Min Read

How to display number in hexadecimal form in C++ Program

#include 
int main()
{
int x;
cout << Enter an integer:" << endl; cin >> x; // hex keyword displays a number in hexadecimal form.
cout << "x=" << hex << x << endl;
cin.get();
return 0;
}
Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version