Code Competitions

Coding competition

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();
}

No comments:

Post a Comment