【MIPS】计算N!
编程环境:PCspim
1 .text 2 .globl main 3 4 main: 5 la $a0,input_num_msg; 6 li $v0,4 7 syscall 8 9 li $v0,5 10 syscall 11 12 move $t8,$v0 13 move $t0,$zero 14 addi $t0,$t0,1 15 16 multiply: 17 mul $t0,$t0,$t8 18 sub $t8,$t8,1 19 slti $t2,$t8,1 20 beq $t2,0,multiply 21 22 la $a0,output_int_msg; 23 li $v0,4 24 syscall 25 26 move $a0,$t0 27 li $v0,1 28 syscall 29 30 31 .data 32 input_num_msg:.asciiz "Please enter the number:\n" 33 output_int_msg:.asciiz "The multiplied number is:\n"
效果演示