.text main: li $t0, 1 # i = 1 li $t1, 0 # sum = 0 loop_cond: bgt $t0, 100, loop_end # if (i > 100) { goto loop_end;} loop_body: mul $t2, $t0, $t0 # tmp = i*i add $t1, $t1, $t2 # sum = sum + tmp add $t0, $t0, 1 # i = i + 1 b loop_cond # goto loop_cond loop_end: li $v0, 4 # syscall 4: print_string la $a0, msg # syscall # printf("he sum of the squares of the first 100 natural numbers is "); li $v0, 1 # syscall move $a0, $t1 syscall # printf("%d", sum); li $v0, 11 # syscall la $a0, '\n' syscall # printf(".\n") li $v0, 0 jr $ra # return 0; .data msg: .asciiz "The sum of the squares of the first 100 natural numbers is "