This Program Take a No from User Reverse it to check that it is Palindrome or Not Assembly Language Code From Programming SeekerzzZZ
include irvine32.inc
.data
num word 0
key word 0
temp word 0
i word 0
reverse word 0
msg byte "Enter the number: ",0
msg1 byte " No is Palindrome ",0
msg2 byte " Not a Palindrome ",0
.code
Main proc
call crlf
call clrscr
mov edx,offset msg
call writestring
call readint
mov temp,ax
mov key,ax
.while temp > 0
mov dx,0
mov ax,temp
mov bx,10
div bx
mov temp,ax
mov num,dx
mov ax,num
mov ax,10
mov bx,reverse
mul bx
add ax,num
mov reverse,ax
call crlf
.endw
mov ax,key
.if reverse != ax
call crlf
mov edx,offset msg2
call writestring
.else
call crlf
mov edx,offset msg1
call writestring
.endif
exit
main endp
end main
include irvine32.inc
.data
num word 0
key word 0
temp word 0
i word 0
reverse word 0
msg byte "Enter the number: ",0
msg1 byte " No is Palindrome ",0
msg2 byte " Not a Palindrome ",0
.code
Main proc
call crlf
call clrscr
mov edx,offset msg
call writestring
call readint
mov temp,ax
mov key,ax
.while temp > 0
mov dx,0
mov ax,temp
mov bx,10
div bx
mov temp,ax
mov num,dx
mov ax,num
mov ax,10
mov bx,reverse
mul bx
add ax,num
mov reverse,ax
call crlf
.endw
mov ax,key
.if reverse != ax
call crlf
mov edx,offset msg2
call writestring
.else
call crlf
mov edx,offset msg1
call writestring
.endif
exit
main endp
end main
0 comments:
Post a Comment