Assembly - Tinh giai thua

.data noti: .asciiz "Nhap n : " res: .asciiz "Ket qua : " .text main: la $a0, noti addi $v0, $0, 4 syscall # nhap n addi $v0, $0, 5 syscall addi $s0, $v0, 0 # n luu trong s0 addi $s1, $0, 1 # khoi tao s1 = 1 -> tich giai thua addi $t1, $0, 1 # khoi tao t1 = 1 -> bien dem lap: # quy trinh tinh giai thua mult $s1, $t1 # temp = s1 * t1 mflo $s1 # s1 = temp addi $t1, $t1, 1 # t1++ ble $t1, $s0 lap # while (t1 <= n) # in thong bao ket qua la $a0, res addi $v0, $0, 4 syscall #in ket qua addi $a0, $s1, 0 addi $v0, $0, 1 syscall

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.