Sunday, October 3, 2010

how will you convert a hexadecimal ABC into its octal and decimal equivalent ?

 #include
#include
void main()
{
int a,b,c;
int h=16,i=8,j=10;
long e,f,g;
long m,n,o,p;// modulas
long u,v,x,y,z;//dividing

clrscr();
printf("\n\t The Hexadecimal Value is\t:\tABC");
a=10;
b=11;
c=12;
e=a+(b*h)+(c*h*h);

printf("\n\n\t the decimal value is\t\t:\t%ld",e);
f=e/i;
m=e%i;
n=f/i;
u=f%i;
x=u/i;
o=u%i;
printf("\n\n\t The Octal value is\t\t:\t%d%d%d",m,u,o);



getch();
}

No comments: