Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- fn_2: .word 0
- fn_1: .word 1
- fn: .word 0
- n: .word 0
- spaceInsert: .asciiz " "
- prompt: .asciiz "Please enter a positive integer: "
- .text
- .globl main
- main:
- li $v0, 4
- la $a0, prompt
- syscall
- li $v0, 5
- la $a0, n
- syscall
- lw $t0, n
- lw $s0, fn_2
- lw $s1, fn_1
- lw $s2, fn
- li $t1, 1
- loop: add $s2, $s1, $s0
- li $v0, 4
- la $a0, spaceInsert
- syscall
- li $v0, 1
- move $a0, $s2
- syscall
- move $s0, $s1
- move $s1, $s2
- add $t0, $t0, 1
- blt $t1, $t0, loop
- Exit:
- li $v0, 10
- syscall
Add Comment
Please, Sign In to add comment