i m doing it with terminal(ubuntu)
my full program is
;Initialized variables
section .data
message: db "Enter any number from 0 to 9: "
message_length: equ $-message
;Un-initialized variables
section .bss
digit1: resb 1
digit2: resb 1
num: resb 1
sum: resb 1
section .text
global _start
_start:
;Printing prompt message
mov eax, 4
mov ebx, 1
mov ecx, message
mov edx, message_length
int 80h
;Reading the digit
mov eax, 3
mov ebx, 0
mov ecx, digit1
mov edx, 2
int 80h
;Read and ignore an extra character as the system will read enter
;press as well
int 80h
;Calculating the number from digits
sub byte[digit1], 30h
mov byte[sum], 0
mov cl, byte[digit1]
;Initializing sum to zero
;Initializing loop variable(ecx) to number
;Loop for adding cx to num
adding:
add byte[sum], cl
Loop adding
;The result could be maximum of 2 digits......
;In the remaining section of the code, we will break the
;number so as to print each digit one by one
mov al, byte[sum]
mov bl, 10
div bl
mov byte[digit2], al
mov byte[digit1], ah
;Converting the digit to its ASCII by adding 30h
add byte[digit1], 30h
add byte[digit2], 30h
;Printing each digits.............
mov eax, 4
mov ebx, 1
mov ecx, digit2
mov edx, 1
int 80h
mov eax, 4
mov ebx, 1
mov ecx, digit1
mov edx, 1
int 80h
mov eax, 4
mov ebx, 1
mov ecx, 0Ah
mov edx, 1
int 80h
;Exit code
mov eax, 1
mov ebx, 0
int 80h