Write a C program that prompts the user to enter a hex value, muliplies it by ten, then displays the result in hex.
I already made a fuction hexToInt and intToHex, but I am still puzzled and how to mulitply it by 10. After I read in the string then I think I should convert the hex to int then mulitply it by 10 the convert the int back to hex.
I can't do a n*=10 ??
Code:#include <stdio.h> #include "readIn.h" #include "hexToInt.h" #include "intToHex.h" #define BUFFER_SIZE 9 int main() { unsigned char *n; unsigned int temp; n=malloc(BUFFER_SIZE); printf("Enter a Hexadecimal >> "); fflush(stdout); readIn(n, BUFFER_SIZE); printf("%d\n",hexToInt(n)); /*i can't do n*=10 */ printf("%x\n",intToHex(n)); fflush(stdout); return 0; }



LinkBack URL
About LinkBacks


