You made me laugh with your post to convert decimal to hex, including "A,B...G"
*G* ??
Anyway, your algorithm to change decimal to hexadecimal is wrong. Here's a modded version of your program, which shows what the hex value of a decimal, should be:
#include <stdio.h>
int main(void)
{
int hexa = 16, deci, quotient, ctr;
printf("enter decimal number: ");
scanf("%d",&deci);
for (ctr = 1; ctr<=deci; ctr++)
quotient = deci / hexa;
printf("Equivalent in Hexadecimal is %d",quotient);
printf("\n\n Try this for Hexadecimal: %X", deci);
getche();
return 0;
}
Good luck with your studies.
Reputation Points: 416
Solved Threads: 181
Nearly a Posting Virtuoso
Offline 1,463 posts
since Jun 2008