+ 1

write a program to find the octal & hexa decimal equivalent of the entered decimal no.

22nd Sep 2016, 2:25 AM
Meena
Meena - avatar
1 Answer
+ 1
#include <iostream> # include <iomanip> using namespace std; int main() { int num; cin>>num; cout<<"your number: "<<num<<endl; cout<<"hex = "<<hex<<num<<endl; cout<<"oct = "<<oct<<num<<endl; return 0; } /* use these headers: #include <iostream> # include <iomanip> using namespace std; then, in a cout statement, write hex or oct, the next number after that will be written in hex or oct. example cout<<oct<<9; (writes 11, octal for nine) int test = 15; cout<<hex<<test; (writes f, hexa for 15) */
26th Sep 2016, 6:15 PM
Andres Mar