SHARE
TWEET

Untitled

a guest Jul 19th, 2017 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data .word
  2. length: 22
  3. .byte
  4. numbers: 3, 1, 5, 7, 4, 4, 1, 0, 3, 5, 4, 4, 5, 3, 0, 1, 4, 4, 7, 5, 1, 3
  5.  
  6. .asciiz
  7. correct: "Zahlenpalindrom erkannt"
  8. missed: "kein Zahlenpalindrom"
  9.  
  10. .text
  11.  
  12. #########################################################################
  13. #                    Ergaenzen Sie hier Ihre Loesung                    #
  14. #########################################################################
  15.  
  16. la  $s0, numbers
  17. xor $t0,$t0,$t0
  18. lw  $t1, length
  19. addi $t1, $t1, -1
  20. loop:
  21. sub $t3, $t1, $t0
  22. slti $t3, $t3, 2
  23. bne $t3,$0 palindrom
  24. add $t3, $s0, $t0
  25. lb  $t2, 0($t3)
  26. add $t3, $s0, $t1
  27. lb  $t3, 0($t3)
  28. bne $t2, $t3, no_palindrom
  29. addi $t0, $t0, 1
  30. addi $t1, $t1, -1
  31.  
  32. j loop
  33. #########################################################################
  34.  
  35. palindrom:
  36. li $v0, 4
  37. la $a0,correct
  38. syscall
  39. li $v0, 10
  40. syscall
  41.  
  42. no_palindrom:
  43. li $v0, 4
  44. la $a0, missed
  45. syscall
  46. li $v0, 10
  47. syscall
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top