Code Competitions

Coding competition
Showing posts with label decimal to octal and hexadecimal using setbase. Show all posts
Showing posts with label decimal to octal and hexadecimal using setbase. Show all posts

Monday, 3 June 2013

program to convert a decimal to octal, hexadecimal

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
void main()
{
    int a;
    clrscr();
    cout<<"enter the value of a";
    cin>>a;
    cout<<"\nhexadecimal number "<<setbase(16)<<a;
    cout<<"\ndecimal number "<<setbase(10)<<a;
    cout<<"\noctal number "<<setbase(8)<<a;
    cout<<"\nthe value of a "<<a;
    getch();
}