Advertisement
Alex9090

LAB 9 Calculatoare numerice

Apr 26th, 2018
671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2. .globl main
  3.  
  4. main:
  5.  
  6. l.s $f2, R
  7. l.s $f3, n1
  8. l.s $f4, n2
  9. l.s $f5, pi
  10.  
  11. li $v0, 2
  12. mul.s $f5, $f5, $f4
  13. mul.s $f5, $f5, $f2
  14. mov.s $f12, $f5
  15. syscall
  16.  
  17. li $v0, 4
  18. la $a0, msg
  19. syscall
  20.  
  21. li $v0, 2
  22. mul.s $f5, $f5, $f2
  23. div.s $f5, $f5, $f3
  24. mov.s $f12, $f5
  25. syscall
  26.  
  27.  
  28. li $v0, 10
  29. syscall
  30.  
  31. .data
  32.  
  33. n1: .float 3.0
  34. n2: .float 4.0
  35. R: .float 10.0
  36. pi: .float 3.14
  37.  
  38. msg: .asciiz "\n"
  39. ^^^ ARIA SFERA, VOLUM SFERA
  40.  
  41.  
  42. .text
  43. .globl main
  44.  
  45. main:
  46.  
  47. li $t0, 12
  48. lw $a0, a($t0)
  49.  
  50. li $v0, 1
  51. syscall
  52.  
  53. li $v0, 4
  54. la $a0, newLine
  55. syscall
  56.  
  57. la $t1, a
  58. lw $a0, 4($t1)
  59. li $v0, 1
  60. syscall
  61.  
  62. li $v0, 10
  63. syscall
  64.  
  65. .data
  66. a: .word 69, 34, 2, 85, 7, 52, 48, 17, 22
  67.  
  68. newLine: .asciiz"\n"
  69.  
  70.  
  71.  
  72.  
  73. SUMA PATRATELOR DE LA 1 LA N
  74.  
  75. .text
  76. .globl main
  77.  
  78. main:
  79.  
  80. lw $t0, n
  81. li $t1, 1
  82. li $t2, 0
  83.  
  84. buclaSumare:
  85. mul $t3, $t1, $t1
  86. add $t2, $t2, $t3
  87. add $t1, $t1, 1
  88. ble $t1, $t0, buclaSumare
  89.  
  90. move $a0, $t2
  91. li $v0, 1
  92. syscall
  93.  
  94. li $v0, 10
  95. syscall
  96.  
  97. .end main
  98.  
  99. .data
  100.  
  101. n: .word 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement