.data validPalindromeMsg: .asciiz "The number is a palindrome." unValidPalindromeMsg: .asciiz "The number is not a palindrome." .text .globl main main: jal input j loop input: li $v0, 5 syscall move $t0, $v0 move $t1,$t0 # copy t0 to t1 for keep original value li $t2,0 # load 0 to checker jr $ra loop: rem $t3,$t1,10 mul $t2,$t2,10 add $t2,$t2,$t3 sub $t1,$t1,$t3 div $t1,$t1,10 beq $t1,0,check j loop check: beq $t0,$t2,printValidMsg j printUnvalidMsg printValidMsg: la $t4,validPalindromeMsg add $a0,$zero,$t4 li $v0,4 syscall j exit printUnvalidMsg: la $t4,unValidPalindromeMsg add $a0,$zero,$t4 li $v0,4 syscall j exit exit: li $v0,10 syscall