Home » C++ Programming » Basic Input/Output » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main ()
    {
    int num;
    num = 45;
    cout << hex << num << endl;
    return 0;
    }
    1. 45
    2. 2d
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: B

In this program, We are printing the hexadecimal value of the given decimal number by using hex function.



Your comments will be displayed only after manual approval.