add num,al ret readnum endp hex2asc proc near push ax push bx push cx push dx push si mov cx,00h mov bx,0Ah rpt1: mov dx,00 div bx add dl,'0' push dx inc cx cmp ax,0Ah jge rpt1 add al,'0' mov [si],al rpt2: pop ax inc si mov [si],al loop rpt2 inc si mov al,'$' mov [si],al pop si pop dx pop cx pop bx pop ax ret hex2asc endp end Output: Enter the radius:02 Volume of sphere is:32 Enter the radius:04 Volume of sphere is:256 Ex 13: Write a program to convert Centigrade (Celsius) to Fahrenheit temperature measuring scales. Using formula: Celsius = (Fahrenheit - 32) * 5 / 9 Ans: Prg(farcel.asm) Title convert temperature celsius to Farenheit: dosseg .model small .stack .data msg1 db 13,10,"Enter a number to find fahrenheit temperature:$" msg2 db 13,10,"Fahrenheit Temperature is:$" num db ? res db 10 DUP('$') .code main proc mov ax,@data mov ds,ax lea dx,msg1 mov ah,09h int 21h call readnum mov bx,00 mov bx,9
add num,al ret readnum endp hex2asc proc near push ax push bx push cx push dx push si mov cx,00h mov bx,0Ah rpt1: mov dx,00 div bx add dl,'0' push dx inc cx cmp ax,0Ah jge rpt1 add al,'0' mov [si],al rpt2: pop ax inc si mov [si],al loop rpt2 inc si mov al,'$' mov [si],al pop si pop dx pop cx pop bx pop ax ret hex2asc endp end Output: Enter the radius:02 Volume of sphere is:32 Enter the radius:04 Volume of sphere is:256 Ex 13: Write a program to convert Centigrade (Celsius) to Fahrenheit temperature measuring scales. Using formula: Celsius = (Fahrenheit - 32) * 5 / 9 Ans: Prg(farcel.asm) Title convert temperature celsius to Farenheit: dosseg .model small .stack .data msg1 db 13,10,"Enter a number to find fahrenheit temperature:$" msg2 db 13,10,"Fahrenheit Temperature is:$" num db ? res db 10 DUP('$') .code main proc mov ax,@data mov ds,ax lea dx,msg1 mov ah,09h int 21h call readnum mov bx,00 mov bx,9