cpp
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
void DEXTOHEX(long int jem);
long int jem;
long int temp,temp2;
char choice;
main()
{
clrscr();
gotoxy(5,3);printf("================================================================");
gotoxy(5,4);printf("=== ===");
gotoxy(5,5);printf("=== [A] convert decimal to binary and vice versa. ===");
gotoxy(5,6);printf("=== [B] convert decimal to octal and vice versa. ===");
gotoxy(5,7);printf("=== [C] convert decimal to hexadecimal and vice versa. ===");
gotoxy(5,8);printf("=== [D] convert binary to octal and vice versa. ===");
gotoxy(5,9);printf("=== [E] convert binary to hexadecimal and vice versa. ===");
gotoxy(5,10);printf("=== [F] convert octal to hexadecimal and vice versa. ===");
gotoxy(5,11);printf("=== ===");
gotoxy(5,12);printf("=== Enter Choice [ ] ===");
gotoxy(5,13);printf("================================================================");
gotoxy(26,12);choice=getche();
clrscr();
switch(choice)
{
case 'A':
case 'a':
{
clrscr();
printf("Convert Decimal to Binary and vice versa");
gotoxy(5,10);printf("Enter the Decimal Number:");
gotoxy(30,10);scanf("%ld",&jem);
break;
}
case 'B':
case 'b':
{
clrscr();
printf("Convert Decimal to Octal and Vice Versa");
gotoxy(5,10);printf("Enter the Decimal Number:");
gotoxy(30,10);scanf("%ld",&jem);
break;
}
case 'C':
case 'c':
{
clrscr();
printf("Convert Decimal to Hexadecimal and Vice Versa");
gotoxy(5,10);printf("Enter the Decimal Number:");
gotoxy(30,10);scanf("%ld",&jem);
DECTOHEX(jem);
break;
}
default:
{
clrscr();
printf("under construction");
}
}
getch();
}
void DECTOHEX(long int jem)
{
long int bin = 0;
int b,p=0;
temp=jem;
while (jem>0)
{
b=jem%16;
jem=jem/16;
bin=bin+b*pow(10,p++);
}
gotoxy(5,15);printf("The Hexadecimal Equivalent of %ld is %c",temp,bin);
}
.....I am having trouble with this one. 10 in decimal should be A in hex but not. pls help

** Edit **