.data
N:
.word 1
result:
.word 0
.text
li $t0, 10
li $t4, 0
lw $s3, N # ‘N’ is a variable stored in memory (with some unknown value)
Loop:
beq $s3, $t4, Exit
addi $t0, $t0, 4
addi $s3, $s3, -1
j Loop
Exit:
sw $t0, result # ‘result’ is a variable stored in memory
li $v0, 10 #system call code for exit
syscall #exit the program