Friday, October 20, 2017

Decimal to Hexadecimal and Octal in C++

Decimal to Hexadecimal and Octal in C++.
This program will display decimal number into Hexadecimal and Octal.

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
  int number=100;
  cout << "Hexadecimal of 100 is: ";
  cout << hex << number << endl;
  cout << "Octal of 100 is: ";
  cout << oct << number << endl;
  return 0;
}

Output of program

Hexadecimal of 100 is: 64
Octal of 100 is: 144


No comments:

Post a Comment