Sunday, November 18, 2012

conver decimal to Hexadecimal in C++

#include<iostream.h>
#include<conio.h>
int main ()
{
    int num,i=0;
    cout<<"Enter the decimal number:";
    cin>> num;
    while(num>0)
    {
                i=num%16;
                num=num/16;  cout<<i;
                }
               cout<<"(Result in reverse order)";
                getch ();
                return 0;
}

No comments:

Post a Comment