venkates2218
Full Member level 6
Code:
int n;
char hexaDeciNum[3];
void decToHexa(int n) {
int i = 0;
while (n != 0) {
// temporary variable to store remainder
int temp = 0;
// storing remainder in temp variable.
temp = n % 16;
// check if temp < 10
if (temp < 10) {
hexaDeciNum[i] = temp + 48;
i++;
} else {
hexaDeciNum[i] = temp + 55;
i++;
}
n = n / 16;
}
}
This program is used to convert the DECIMAL value into HEXADECIMAL.
It working fine,but the generated values are inverted.
In DEC 125 means 7D
but the output in the controller is D7.
I have to combine the two values into one value..