LXI H, 4150 ; Point to data
LXI B, 0000 ; Initialize hundreds= 0, Tens=0
MOV A, M ; Get hex data to A
LOOP: SUI 64
JC LOOP 1
INR B ; hundreds= hundreds+1
JMP LOOP
LOOP 1: ADI 64 ; if subtracted extra, add it clear carry flag
LOOP 2: SUI 0A
JC LOOP 3
INR C ; Tens=tens+1
JMP LOOP 2
LOOP 3: ADI 0A ; If subtracted extra, add it again
INX H ; A = Units
MOV M, B ; store hundreds
MOV B, A ; Combine Tens in C &
MOV A, C ; Units in A to form a
RLC ; Single 8-bit number
RLC
RLC
RLC
ADD B
INX H
MOV M, A ; Store tens & Units
HLT
This is not a question.
write a c++ program to convert binary number to decimal number by using while statement
Use the %X modifier of printf.Code Example:#include int main(void) { unsigned int iMyNumber = 255; printf("The number %u interpreted as hexadecimal is %X.\n", iMyNumber, iMyNumber); return 0; }
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
Divide it by 1000.
Write a program to convert a 2-digit BCD number into hexadecimal
WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL
pongada punda vayanungala ..................
This is not a question.
Write a program to convert a 2-digit BCD number into hexadecimal
try this i got output: int main(){ int o; scanf("%o",&o); printf("%x",o); getch(); }
write a c++ program to convert binary number to decimal number by using while statement
One way to accomplish this is to allow the printf statement to do the work for you. Example: printf("Decimal %d = hex %02x\n", number, number); Or you could use the windows calculator. Select the Dec radian, type your number in, then select Hex radian.
int main (void) { puts ("210H"); return 0; }
90 = 1011010 (or 5A in hexadecimal).
Writing H after a number means the number is a hexadecimal, or base 16, number.
Assuming the original number is written in base 10, there is no need to convert this to base 10 as it is already there. The hexadecimal number represented as 601 in base 16 is represented in decimal as 1537.