Reputation: 19
I have to write program that calculates factorial for large numbers (e.g 200). This is very important for me. Here is my code:
.text
main:
li $v0, 4
la $a0, prompt
syscall
li $v0, 5
syscall
move $s0, $v0
move $t1, $v0
li $t0, 1
loop:
mul $t0, $t0, $s0
addi $s0, $s0, -1
bgtz $s0, loop
li $v0, 1
move $a0, $t0
syscall
li $v0, 10
syscall
.data
prompt: .asciiz "\nGive a number: "
This program works only for numbers less than 31. I don't know how to fix it. Someone can help me?
P.S Sorry for my bad language.
Upvotes: 0
Views: 2947