SlideShare a Scribd company logo
.data
EnterA : .asciiz "Nhap A "
EnterB : .asciiz "Nhap B "
Menu : .asciiz "----------------------------Menu------------------------nn1. Tong a
va bn2. Hieu a va bn3. Tich a va bn4. Thuong a va bn5. Kiem tra a va b la so
nguyen to ?n6. Kiem tra a va b la so hoan thien ?n7. Kiem tra a va b la so chinh
phuong ?n8. Kiem tra a va b la so doi xung ?n0. Thoatn--------------------------------------------------------------------n"
Chose: .asciiz "Chon "
Tong : .asciiz "Tong : "
Hieu : .asciiz "Hieu : "
Tich : .asciiz "Tich : "
Thuong : .asciiz "Thuong : "
Result : .asciiz "Ket qua: "
True_Nt_A : .asciiz "A la so nguyen to"
False_Nt_A : .asciiz "A khong phai so nguyen to"
True_Nt_B : .asciiz "nB la so nguyen to"
False_Nt_B : .asciiz "nB khong phai so nguyen to"
True_Ht_A:
False_Ht_A
True_Ht_B:
False_Ht_B

.asciiz "A la so hoan thien"
: .asciiz "A khong phai so hoan thien"
.asciiz "nB la so hoan thien"
: .asciiz "nB khong phai so hoan thien"

True_Cp_A:
False_Cp_A
True_Cp_B:
False_Cp_B

.asciiz "A la so chinh phuong"
: .asciiz "A khong phai so chinh phuong"
.asciiz "nB la so chinh phuong"
: .asciiz "nB khong phai so chinh phuong"

True_Dx_A:
False_Dx_A
True_Dx_B:
False_Dx_B

.asciiz "A la so doi xung"
: .asciiz "A khong phai so doi xung"
.asciiz "nB la so doi xung"
: .asciiz "nB khong phai so doi xung"

.text
.globl main
main:

li $v0,4 #print "Nhap a"
la $a0,EnterA
syscall
li $v0,5 #scan a
syscall
move $s0,$v0
li $v0,4 #print "Nhap b"
la $a0,EnterB
syscall
li $v0,5 #scan b
syscall
move $s1,$v0
li $v0,4 #print "Menu"
la $a0,Menu
syscall
li $v0,4 #print "Chon"
la $a0,Chose
syscall
li $v0,5 #scan k
syscall
move $s2,$v0
li $v0,4 #print "Ket qua : "
la $a0,Result
syscall
addi $t0,$s2,-1
bne $t0,$0,Subtraction #k==0 Jump -> Exit
add $s3,$s1,$s0 #S=a+b
li $v0,4 #print "Tong : "
la $a0,Tong
syscall
move $a0,$s3
li $v0,1 #print "Tong"
syscall
j Exit
Subtraction:
addi $t0,$s2,-2
bne $t0,$0,Multiplication
sub $s3,$s0,$s1 #S=a-b
li $v0,4 #print "Hieu : "
la $a0,Hieu
syscall
move $a0,$s3
li $v0,1 #print Hieu
syscall
j Exit
Multiplication:
addi $t0,$s2,-3
bne $t0,$0,Division
mult $s1,$s0 #S=a*b
mflo $s3
li $v0,4 #print "Tich : "
la $a0,Tich
syscall
move $a0,$s3
li $v0,1 #print Tich
syscall
j Exit
Division:
addi $t0,$s2,-4
bne $t0,$0,Prime
div $s0,$s1 #S=a/b
mflo $s3
li $v0,4 #print "Thuong : "
la $a0,Thuong
syscall
move $a0,$s3
li $v0,1 #print Thuong
syscall

Prime:
addi $t0,$s2,-5
bne $t0,$0,CompleteNumber
addi $s4,$0,2 #i=2
addi $s5,$0,1 #check = 1
Nt_A_Loop:
slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a
beq $t0,$0,Nt_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
div $s0,$s4 # a%i
mfhi $s6 #temp = a%i
bne $s6,$0,Nt_A_ExitIf
add $s5,$0,$0
j Nt_A_ExitLoop
Nt_A_ExitIf:
addi $s4,$s4,1
j Nt_A_Loop
Nt_A_ExitLoop:
bne $s5,$0,Nt_A_CheckIf
li $v0,4 #print "A khong la so nguyen to "
la $a0,False_Nt_A
syscall
j Nt_A_CheckElse
Nt_A_CheckIf:
li $v0,4 #print "A la so nguyen to "
la $a0,True_Nt_A
syscall
Nt_A_CheckElse:
addi $s4,$0,2 #i=2
addi $s5,$0,1 #check = 1
Nt_B_Loop:
slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a
beq $t0,$0,Nt_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
div $s1,$s4 # a%i
mfhi $s6 #temp = a%i
bne $s6,$0,Nt_B_ExitIf
add $s5,$0,$0
j Nt_B_ExitLoop
Nt_B_ExitIf:
addi $s4,$s4,1
j Nt_B_Loop
Nt_B_ExitLoop:
bne $s5,$0,Nt_B_CheckIf
li $v0,4 #print "A khong la so nguyen to "
la $a0,False_Nt_B
syscall
j Nt_B_CheckElse
Nt_B_CheckIf:
li $v0,4 #print "A la so nguyen to "
la $a0,True_Nt_B
syscall
Nt_B_CheckElse:
j Exit
CompleteNumber:
addi $t0,$s2,-6
bne $t0,$0,SquareNumber
addi $s3,$0,0 #s=0
addi $s4,$0,1 #i = 1
Ht_A_Loop:
slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a
beq $t0,$0,Ht_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
div $s0,$s4 # a%i
mfhi $s6 #temp = a%i
bne $s6,$0,Ht_A_ExitIf
add $s3,$s3,$s4
Ht_A_ExitIf:
addi $s4,$s4,1
j Ht_A_Loop
Ht_A_ExitLoop:
bne $s3,$s0,Ht_A_CheckIf
li $v0,4 #print "A la so hoan thien"
la $a0,True_Ht_A
syscall
j Ht_A_CheckElse
Ht_A_CheckIf:
li $v0,4 #print "A khong la so hoan thien"
la $a0,False_Ht_A
syscall
Ht_A_CheckElse:
addi $s3,$0,0 #s=0
addi $s4,$0,1 #i = 1
Ht_B_Loop:
slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a
beq $t0,$0,Ht_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
div $s1,$s4 # a%i
mfhi $s6 #temp = a%i
bne $s6,$0,Ht_B_ExitIf
add $s3,$s3,$s4
Ht_B_ExitIf:
addi $s4,$s4,1
j Ht_B_Loop
Ht_B_ExitLoop:
bne $s3,$s1,Ht_B_CheckIf
li $v0,4 #print "A la so hoan thien"
la $a0,True_Ht_B
syscall
j Ht_B_CheckElse
Ht_B_CheckIf:
li $v0,4 #print "A khong la so hoan thien"
la $a0,False_Ht_B
syscall
Ht_B_CheckElse:
j Exit
SquareNumber:
addi $t0,$s2,-7
bne $t0,$0,SymmetryNumber
addi $s5,$0,0 #check=0
addi $s4,$0,1 #i = 1
Cp_A_Loop:
slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a
beq $t0,$0,Cp_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
mult $s4,$s4 # a*a
mflo $s6 #temp = a*a
bne $s6,$s0,Cp_A_ExitIf
addi $s5,$0,1 #check=1
j Cp_A_ExitLoop
Cp_A_ExitIf:
addi $s4,$s4,1
j Cp_A_Loop
Cp_A_ExitLoop:
beq $s5,$0,Cp_A_CheckIf
li $v0,4 #print "A la so hoan thien"
la $a0,True_Cp_A
syscall
j Cp_A_CheckElse
Cp_A_CheckIf:
li $v0,4 #print "A khong la so hoan thien"
la $a0,False_Cp_A
syscall
Cp_A_CheckElse:

addi $s5,$0,0 #check=0
addi $s4,$0,1 #i = 1
Cp_B_Loop:
slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a
beq $t0,$0,Cp_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat
mult $s4,$s4 # a*a
mflo $s6 #temp = a*a
bne $s6,$s1,Cp_B_ExitIf
addi $s5,$0,1 #check=1
j Cp_B_ExitLoop
Cp_B_ExitIf:
addi $s4,$s4,1
j Cp_B_Loop
Cp_B_ExitLoop:
beq $s5,$0,Cp_B_CheckIf
li $v0,4 #print "A la so hoan thien"
la $a0,True_Cp_B
syscall
j Cp_B_CheckElse
Cp_B_CheckIf:
li $v0,4 #print "A khong la so hoan thien"
la $a0,False_Cp_B
syscall
Cp_B_CheckElse:

j Exit
SymmetryNumber:
addi $t0,$s2,-8
bne $t0,$0,Exit
addi $s3,$0,0 #dao=0
add $s4,$s0,$0 #m=a
Dx_A_Loop:
slt $t0,$0,$s4 #0>=m thi 0, 0<m thi 1
beq $t0,$0,Dx_A_ExitLoop # 0<=m thi thoat
addi $s7,$0,10 # $s7 = 10
mult $s3,$s7 # dao*10
mflo $s3 # dao=dao*10
div $s4,$s7
mfhi $s6 # temp = m % 10
add $s3,$s3,$s6 # dao = dao + temp
div $s4,$s7
mflo $s4
j Dx_A_Loop
Dx_A_ExitLoop:
bne $s3,$s0,Dx_A_CheckIf
li $v0,4
la $a0,True_Dx_A
syscall
j Dx_A_CheckElse
Dx_A_CheckIf:
li $v0,4
la $a0,False_Dx_A
syscall
Dx_A_CheckElse:

addi $s3,$0,0 #dao=0
add $s4,$s1,$0 #m=a
Dx_B_Loop:
slt $t0,$0,$s4 #0>=m thi 0, 0<m thi 1
beq $t0,$0,Dx_B_ExitLoop # 0<=m thi thoat
addi $s7,$0,10 # $s7 = 10
mult $s3,$s7 # dao*10
mflo $s3 # dao=dao*10
div $s4,$s7
mfhi $s6 # temp = m % 10
add $s3,$s3,$s6 # dao = dao + temp
div $s4,$s7
mflo $s4
j Dx_B_Loop
Dx_B_ExitLoop:
bne $s3,$s1,Dx_B_CheckIf
li $v0,4
la $a0,True_Dx_B
syscall
j Dx_B_CheckElse
Dx_B_CheckIf:
li $v0,4
la $a0,False_Dx_B
syscall
Dx_B_CheckElse:
j Exit
Exit:
li $v0, 10
syscall

More Related Content

What's hot

Hop ngu mips
Hop ngu mipsHop ngu mips
Hop ngu mips
mster_dang
 
Đại số boolean và mạch logic
Đại số boolean và mạch logicĐại số boolean và mạch logic
Đại số boolean và mạch logic
www. mientayvn.com
 
Chuong 4.1 tin hieu va pho
Chuong 4.1 tin hieu va phoChuong 4.1 tin hieu va pho
Chuong 4.1 tin hieu va phothanhyu
 
lý thuyết cơ sở dữ liệu phân tán
lý thuyết cơ sở dữ liệu phân tánlý thuyết cơ sở dữ liệu phân tán
lý thuyết cơ sở dữ liệu phân tánNgo Trung
 
Kiến trúc máy tính và hợp ngữ bài 02
Kiến trúc máy tính và hợp ngữ bài 02Kiến trúc máy tính và hợp ngữ bài 02
Kiến trúc máy tính và hợp ngữ bài 02
Nhóc Nhóc
 
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đĐề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
Dịch Vụ Viết Bài Trọn Gói ZALO 0917193864
 
Bai tap-dai-so-tuyen-tinh-co-giai
Bai tap-dai-so-tuyen-tinh-co-giaiBai tap-dai-so-tuyen-tinh-co-giai
Bai tap-dai-so-tuyen-tinh-co-giai
giaoduc0123
 
Công thức truyền tin
Công thức truyền tinCông thức truyền tin
Công thức truyền tinakprovip
 
Kiến trúc máy tính và hợp ngữ bài 07
Kiến trúc máy tính và hợp ngữ bài 07Kiến trúc máy tính và hợp ngữ bài 07
Kiến trúc máy tính và hợp ngữ bài 07
Nhóc Nhóc
 
Hướng dẫn giải bài tập Đại Số Tuyến Tính
Hướng dẫn giải bài tập Đại Số Tuyến TínhHướng dẫn giải bài tập Đại Số Tuyến Tính
Hướng dẫn giải bài tập Đại Số Tuyến Tính
Nhóc Nhóc
 
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
Thanh Giảng Lê
 
Đồ Án Quản Lý Bán Hàng bằng C++
Đồ Án Quản Lý Bán Hàng bằng C++Đồ Án Quản Lý Bán Hàng bằng C++
Đồ Án Quản Lý Bán Hàng bằng C++
nataliej4
 
Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)lieu_lamlam
 
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại vi
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại viĐề Cương ôn tập kiến trúc máy tính và thiết bị ngoại vi
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại viĐỗ Đức Hùng
 
91684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-291684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-2tranquanthien
 
Đề thi Kỹ thuật lập trình có lời giải
Đề thi Kỹ thuật lập trình có lời giảiĐề thi Kỹ thuật lập trình có lời giải
Đề thi Kỹ thuật lập trình có lời giải
nataliej4
 
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thôngBáo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
Huyen Pham
 

What's hot (20)

Chuong04
Chuong04Chuong04
Chuong04
 
Hop ngu mips
Hop ngu mipsHop ngu mips
Hop ngu mips
 
Lttt b11
Lttt b11Lttt b11
Lttt b11
 
Đại số boolean và mạch logic
Đại số boolean và mạch logicĐại số boolean và mạch logic
Đại số boolean và mạch logic
 
17406 bai giang csdl nang cao
17406   bai giang csdl nang cao17406   bai giang csdl nang cao
17406 bai giang csdl nang cao
 
Chuong 4.1 tin hieu va pho
Chuong 4.1 tin hieu va phoChuong 4.1 tin hieu va pho
Chuong 4.1 tin hieu va pho
 
lý thuyết cơ sở dữ liệu phân tán
lý thuyết cơ sở dữ liệu phân tánlý thuyết cơ sở dữ liệu phân tán
lý thuyết cơ sở dữ liệu phân tán
 
Kiến trúc máy tính và hợp ngữ bài 02
Kiến trúc máy tính và hợp ngữ bài 02Kiến trúc máy tính và hợp ngữ bài 02
Kiến trúc máy tính và hợp ngữ bài 02
 
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đĐề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
Đề tài: Quản lý hệ thống bán vé máy bay của Vietnam Airline, 9đ
 
Bai tap-dai-so-tuyen-tinh-co-giai
Bai tap-dai-so-tuyen-tinh-co-giaiBai tap-dai-so-tuyen-tinh-co-giai
Bai tap-dai-so-tuyen-tinh-co-giai
 
Công thức truyền tin
Công thức truyền tinCông thức truyền tin
Công thức truyền tin
 
Kiến trúc máy tính và hợp ngữ bài 07
Kiến trúc máy tính và hợp ngữ bài 07Kiến trúc máy tính và hợp ngữ bài 07
Kiến trúc máy tính và hợp ngữ bài 07
 
Hướng dẫn giải bài tập Đại Số Tuyến Tính
Hướng dẫn giải bài tập Đại Số Tuyến TínhHướng dẫn giải bài tập Đại Số Tuyến Tính
Hướng dẫn giải bài tập Đại Số Tuyến Tính
 
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
Bài giảng ngôn ngữ lập trình C cơ bản trường đại học công nghiệp thực phẩm TP...
 
Đồ Án Quản Lý Bán Hàng bằng C++
Đồ Án Quản Lý Bán Hàng bằng C++Đồ Án Quản Lý Bán Hàng bằng C++
Đồ Án Quản Lý Bán Hàng bằng C++
 
Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)Bo de toan roi rac (on thi cao hoc khmt)
Bo de toan roi rac (on thi cao hoc khmt)
 
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại vi
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại viĐề Cương ôn tập kiến trúc máy tính và thiết bị ngoại vi
Đề Cương ôn tập kiến trúc máy tính và thiết bị ngoại vi
 
91684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-291684060 356-cau-trắc-nghiệm-csdl-2
91684060 356-cau-trắc-nghiệm-csdl-2
 
Đề thi Kỹ thuật lập trình có lời giải
Đề thi Kỹ thuật lập trình có lời giảiĐề thi Kỹ thuật lập trình có lời giải
Đề thi Kỹ thuật lập trình có lời giải
 
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thôngBáo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
Báo cáo bài tập lớn môn Cơ sở dữ liệu - Học viện công nghệ bưu chính viễn thông
 

Viewers also liked

Bai tap mon_lap_trinh_hop_ngu
Bai tap mon_lap_trinh_hop_nguBai tap mon_lap_trinh_hop_ngu
Bai tap mon_lap_trinh_hop_ngu
lakyos
 
lap trinh assembly cho VXL
lap trinh  assembly cho VXLlap trinh  assembly cho VXL
lap trinh assembly cho VXLThân Khương
 
Assembly
AssemblyAssembly
Assembly
Jean Okio
 
03 lap trinh hop ngu voi 8086
03 lap trinh hop ngu voi 808603 lap trinh hop ngu voi 8086
03 lap trinh hop ngu voi 8086onlylove511
 
Chuong 4. lap trinh hop ngu
Chuong 4. lap trinh hop nguChuong 4. lap trinh hop ngu
Chuong 4. lap trinh hop ngu
mituan
 
7 can ban assembly
7 can ban assembly7 can ban assembly
7 can ban assembly
Ly hai
 
Kiến trúc máy tính và hợp ngữ bài 01
Kiến trúc máy tính và hợp ngữ bài 01Kiến trúc máy tính và hợp ngữ bài 01
Kiến trúc máy tính và hợp ngữ bài 01
Nhóc Nhóc
 
baloncesto
baloncestobaloncesto
baloncesto
silva9703
 
Exercicios lista05 hiperestaticas
Exercicios lista05 hiperestaticasExercicios lista05 hiperestaticas
Exercicios lista05 hiperestaticas
Douglas Roberto
 
Anthonys work pp
Anthonys work ppAnthonys work pp
Anthonys work pp
tonysalas217
 
Silladeruedas
SilladeruedasSilladeruedas
Silladeruedas
silva9703
 
Perubahan dan pengembangan organisasi
Perubahan dan pengembangan organisasiPerubahan dan pengembangan organisasi
Perubahan dan pengembangan organisasi
Cendekiawan16
 
40 minutos de la vida de Daniel Chacón y sus amigos
40 minutos de la vida de Daniel Chacón y sus amigos40 minutos de la vida de Daniel Chacón y sus amigos
40 minutos de la vida de Daniel Chacón y sus amigos
DaniChacon98
 
«Социология мировых цивилизаций»
«Социология мировых цивилизаций»«Социология мировых цивилизаций»
«Социология мировых цивилизаций»
денис климов
 
Cyanobacteria 110107033006-phpapp01
Cyanobacteria 110107033006-phpapp01Cyanobacteria 110107033006-phpapp01
Cyanobacteria 110107033006-phpapp01
shamsudin DrGez
 
Othering theory presentation
Othering theory presentationOthering theory presentation
Othering theory presentation
Sal9594
 
More than a bandage for johnson & johnson's hcm
More than a bandage for johnson & johnson's hcmMore than a bandage for johnson & johnson's hcm
More than a bandage for johnson & johnson's hcm
Human Capital Media
 
Asuhan keperawatan tbc
Asuhan keperawatan tbcAsuhan keperawatan tbc
Asuhan keperawatan tbc
Operator Warnet Vast Raha
 

Viewers also liked (20)

Bai tap mon_lap_trinh_hop_ngu
Bai tap mon_lap_trinh_hop_nguBai tap mon_lap_trinh_hop_ngu
Bai tap mon_lap_trinh_hop_ngu
 
lap trinh assembly cho VXL
lap trinh  assembly cho VXLlap trinh  assembly cho VXL
lap trinh assembly cho VXL
 
Assembly
AssemblyAssembly
Assembly
 
03 lap trinh hop ngu voi 8086
03 lap trinh hop ngu voi 808603 lap trinh hop ngu voi 8086
03 lap trinh hop ngu voi 8086
 
Chuong 4. lap trinh hop ngu
Chuong 4. lap trinh hop nguChuong 4. lap trinh hop ngu
Chuong 4. lap trinh hop ngu
 
7 can ban assembly
7 can ban assembly7 can ban assembly
7 can ban assembly
 
Kiến trúc máy tính và hợp ngữ bài 01
Kiến trúc máy tính và hợp ngữ bài 01Kiến trúc máy tính và hợp ngữ bài 01
Kiến trúc máy tính và hợp ngữ bài 01
 
baloncesto
baloncestobaloncesto
baloncesto
 
Exercicios lista05 hiperestaticas
Exercicios lista05 hiperestaticasExercicios lista05 hiperestaticas
Exercicios lista05 hiperestaticas
 
Tutorial
TutorialTutorial
Tutorial
 
Saad ca paru
Saad ca paruSaad ca paru
Saad ca paru
 
Anthonys work pp
Anthonys work ppAnthonys work pp
Anthonys work pp
 
Silladeruedas
SilladeruedasSilladeruedas
Silladeruedas
 
Perubahan dan pengembangan organisasi
Perubahan dan pengembangan organisasiPerubahan dan pengembangan organisasi
Perubahan dan pengembangan organisasi
 
40 minutos de la vida de Daniel Chacón y sus amigos
40 minutos de la vida de Daniel Chacón y sus amigos40 minutos de la vida de Daniel Chacón y sus amigos
40 minutos de la vida de Daniel Chacón y sus amigos
 
«Социология мировых цивилизаций»
«Социология мировых цивилизаций»«Социология мировых цивилизаций»
«Социология мировых цивилизаций»
 
Cyanobacteria 110107033006-phpapp01
Cyanobacteria 110107033006-phpapp01Cyanobacteria 110107033006-phpapp01
Cyanobacteria 110107033006-phpapp01
 
Othering theory presentation
Othering theory presentationOthering theory presentation
Othering theory presentation
 
More than a bandage for johnson & johnson's hcm
More than a bandage for johnson & johnson's hcmMore than a bandage for johnson & johnson's hcm
More than a bandage for johnson & johnson's hcm
 
Asuhan keperawatan tbc
Asuhan keperawatan tbcAsuhan keperawatan tbc
Asuhan keperawatan tbc
 

Similar to Hop ngu MIP

Mips1
Mips1Mips1
Need help optimizing my code for MIPS- Completely lost on how-what to.pdf
Need help optimizing my code for MIPS- Completely lost on how-what to.pdfNeed help optimizing my code for MIPS- Completely lost on how-what to.pdf
Need help optimizing my code for MIPS- Completely lost on how-what to.pdf
actexerode
 
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdfWhat is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
badshetoms
 
MIPS Merge Sort
MIPS Merge SortMIPS Merge Sort
MIPS Merge Sort
Adam Tucker
 
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docxcs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
mydrynan
 
Space Invaders Source Code
Space Invaders Source CodeSpace Invaders Source Code
Space Invaders Source Code
Mitchell Strobel
 
Finish the program below that does several bit-wise manipulations of.pdf
Finish the program below that does several bit-wise manipulations of.pdfFinish the program below that does several bit-wise manipulations of.pdf
Finish the program below that does several bit-wise manipulations of.pdf
fasttrackcomputersol
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
Masahiro Honma
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2
osfameron
 
Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01
Javier Arturo Rodríguez
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
garux
 
32 shell-programming
32 shell-programming32 shell-programming
32 shell-programming
kayalkarnan
 
TypeScript Go(es) Embedded
TypeScript Go(es) EmbeddedTypeScript Go(es) Embedded
TypeScript Go(es) Embedded
Christoph Engelbert
 
Pimp your data
Pimp your dataPimp your data
Pimp your data
sanna fowler
 
Python Fundamentals - Basic
Python Fundamentals - BasicPython Fundamentals - Basic
Python Fundamentals - Basic
Wei-Yuan Chang
 
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
Dimitris Psounis
 
Functional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures editionFunctional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures edition
osfameron
 
C programs
C programsC programs
C programs
Minu S
 
Community Panels: Pandora's Box or Panacea
Community Panels: Pandora's Box or PanaceaCommunity Panels: Pandora's Box or Panacea
Community Panels: Pandora's Box or Panacea
vcuniversity
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言
Simen Li
 

Similar to Hop ngu MIP (20)

Mips1
Mips1Mips1
Mips1
 
Need help optimizing my code for MIPS- Completely lost on how-what to.pdf
Need help optimizing my code for MIPS- Completely lost on how-what to.pdfNeed help optimizing my code for MIPS- Completely lost on how-what to.pdf
Need help optimizing my code for MIPS- Completely lost on how-what to.pdf
 
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdfWhat is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
What is the Insertion Sort MIPS Assembly codeSolution.globl m.pdf
 
MIPS Merge Sort
MIPS Merge SortMIPS Merge Sort
MIPS Merge Sort
 
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docxcs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
cs47_proj_sourceCS47_proj_alu_normal.asm.include .cs47_proj.docx
 
Space Invaders Source Code
Space Invaders Source CodeSpace Invaders Source Code
Space Invaders Source Code
 
Finish the program below that does several bit-wise manipulations of.pdf
Finish the program below that does several bit-wise manipulations of.pdfFinish the program below that does several bit-wise manipulations of.pdf
Finish the program below that does several bit-wise manipulations of.pdf
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
Functional Pe(a)rls version 2
Functional Pe(a)rls version 2Functional Pe(a)rls version 2
Functional Pe(a)rls version 2
 
Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01
 
Descobrindo a linguagem Perl
Descobrindo a linguagem PerlDescobrindo a linguagem Perl
Descobrindo a linguagem Perl
 
32 shell-programming
32 shell-programming32 shell-programming
32 shell-programming
 
TypeScript Go(es) Embedded
TypeScript Go(es) EmbeddedTypeScript Go(es) Embedded
TypeScript Go(es) Embedded
 
Pimp your data
Pimp your dataPimp your data
Pimp your data
 
Python Fundamentals - Basic
Python Fundamentals - BasicPython Fundamentals - Basic
Python Fundamentals - Basic
 
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
ΓΛΩΣΣΑ C - ΜΑΘΗΜΑ 10 (ΕΚΤΥΠΩΣΗ)
 
Functional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures editionFunctional Pe(a)rls - the Purely Functional Datastructures edition
Functional Pe(a)rls - the Purely Functional Datastructures edition
 
C programs
C programsC programs
C programs
 
Community Panels: Pandora's Box or Panacea
Community Panels: Pandora's Box or PanaceaCommunity Panels: Pandora's Box or Panacea
Community Panels: Pandora's Box or Panacea
 
深入淺出C語言
深入淺出C語言深入淺出C語言
深入淺出C語言
 

Recently uploaded

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 

Recently uploaded (20)

Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 

Hop ngu MIP

  • 1. .data EnterA : .asciiz "Nhap A " EnterB : .asciiz "Nhap B " Menu : .asciiz "----------------------------Menu------------------------nn1. Tong a va bn2. Hieu a va bn3. Tich a va bn4. Thuong a va bn5. Kiem tra a va b la so nguyen to ?n6. Kiem tra a va b la so hoan thien ?n7. Kiem tra a va b la so chinh phuong ?n8. Kiem tra a va b la so doi xung ?n0. Thoatn--------------------------------------------------------------------n" Chose: .asciiz "Chon " Tong : .asciiz "Tong : " Hieu : .asciiz "Hieu : " Tich : .asciiz "Tich : " Thuong : .asciiz "Thuong : " Result : .asciiz "Ket qua: " True_Nt_A : .asciiz "A la so nguyen to" False_Nt_A : .asciiz "A khong phai so nguyen to" True_Nt_B : .asciiz "nB la so nguyen to" False_Nt_B : .asciiz "nB khong phai so nguyen to" True_Ht_A: False_Ht_A True_Ht_B: False_Ht_B .asciiz "A la so hoan thien" : .asciiz "A khong phai so hoan thien" .asciiz "nB la so hoan thien" : .asciiz "nB khong phai so hoan thien" True_Cp_A: False_Cp_A True_Cp_B: False_Cp_B .asciiz "A la so chinh phuong" : .asciiz "A khong phai so chinh phuong" .asciiz "nB la so chinh phuong" : .asciiz "nB khong phai so chinh phuong" True_Dx_A: False_Dx_A True_Dx_B: False_Dx_B .asciiz "A la so doi xung" : .asciiz "A khong phai so doi xung" .asciiz "nB la so doi xung" : .asciiz "nB khong phai so doi xung" .text .globl main main: li $v0,4 #print "Nhap a" la $a0,EnterA syscall li $v0,5 #scan a syscall move $s0,$v0 li $v0,4 #print "Nhap b" la $a0,EnterB syscall li $v0,5 #scan b syscall move $s1,$v0 li $v0,4 #print "Menu" la $a0,Menu syscall li $v0,4 #print "Chon"
  • 2. la $a0,Chose syscall li $v0,5 #scan k syscall move $s2,$v0 li $v0,4 #print "Ket qua : " la $a0,Result syscall addi $t0,$s2,-1 bne $t0,$0,Subtraction #k==0 Jump -> Exit add $s3,$s1,$s0 #S=a+b li $v0,4 #print "Tong : " la $a0,Tong syscall move $a0,$s3 li $v0,1 #print "Tong" syscall j Exit Subtraction: addi $t0,$s2,-2 bne $t0,$0,Multiplication sub $s3,$s0,$s1 #S=a-b li $v0,4 #print "Hieu : " la $a0,Hieu syscall move $a0,$s3 li $v0,1 #print Hieu syscall j Exit Multiplication: addi $t0,$s2,-3 bne $t0,$0,Division mult $s1,$s0 #S=a*b mflo $s3 li $v0,4 #print "Tich : " la $a0,Tich syscall move $a0,$s3 li $v0,1 #print Tich syscall j Exit Division: addi $t0,$s2,-4 bne $t0,$0,Prime div $s0,$s1 #S=a/b mflo $s3
  • 3. li $v0,4 #print "Thuong : " la $a0,Thuong syscall move $a0,$s3 li $v0,1 #print Thuong syscall Prime: addi $t0,$s2,-5 bne $t0,$0,CompleteNumber addi $s4,$0,2 #i=2 addi $s5,$0,1 #check = 1 Nt_A_Loop: slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a beq $t0,$0,Nt_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat div $s0,$s4 # a%i mfhi $s6 #temp = a%i bne $s6,$0,Nt_A_ExitIf add $s5,$0,$0 j Nt_A_ExitLoop Nt_A_ExitIf: addi $s4,$s4,1 j Nt_A_Loop Nt_A_ExitLoop: bne $s5,$0,Nt_A_CheckIf li $v0,4 #print "A khong la so nguyen to " la $a0,False_Nt_A syscall j Nt_A_CheckElse Nt_A_CheckIf: li $v0,4 #print "A la so nguyen to " la $a0,True_Nt_A syscall Nt_A_CheckElse: addi $s4,$0,2 #i=2 addi $s5,$0,1 #check = 1 Nt_B_Loop: slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a beq $t0,$0,Nt_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat div $s1,$s4 # a%i mfhi $s6 #temp = a%i bne $s6,$0,Nt_B_ExitIf add $s5,$0,$0 j Nt_B_ExitLoop
  • 4. Nt_B_ExitIf: addi $s4,$s4,1 j Nt_B_Loop Nt_B_ExitLoop: bne $s5,$0,Nt_B_CheckIf li $v0,4 #print "A khong la so nguyen to " la $a0,False_Nt_B syscall j Nt_B_CheckElse Nt_B_CheckIf: li $v0,4 #print "A la so nguyen to " la $a0,True_Nt_B syscall Nt_B_CheckElse: j Exit CompleteNumber: addi $t0,$s2,-6 bne $t0,$0,SquareNumber addi $s3,$0,0 #s=0 addi $s4,$0,1 #i = 1 Ht_A_Loop: slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a beq $t0,$0,Ht_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat div $s0,$s4 # a%i mfhi $s6 #temp = a%i bne $s6,$0,Ht_A_ExitIf add $s3,$s3,$s4 Ht_A_ExitIf: addi $s4,$s4,1 j Ht_A_Loop Ht_A_ExitLoop: bne $s3,$s0,Ht_A_CheckIf li $v0,4 #print "A la so hoan thien" la $a0,True_Ht_A syscall j Ht_A_CheckElse Ht_A_CheckIf: li $v0,4 #print "A khong la so hoan thien" la $a0,False_Ht_A syscall Ht_A_CheckElse:
  • 5. addi $s3,$0,0 #s=0 addi $s4,$0,1 #i = 1 Ht_B_Loop: slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a beq $t0,$0,Ht_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat div $s1,$s4 # a%i mfhi $s6 #temp = a%i bne $s6,$0,Ht_B_ExitIf add $s3,$s3,$s4 Ht_B_ExitIf: addi $s4,$s4,1 j Ht_B_Loop Ht_B_ExitLoop: bne $s3,$s1,Ht_B_CheckIf li $v0,4 #print "A la so hoan thien" la $a0,True_Ht_B syscall j Ht_B_CheckElse Ht_B_CheckIf: li $v0,4 #print "A khong la so hoan thien" la $a0,False_Ht_B syscall Ht_B_CheckElse: j Exit SquareNumber: addi $t0,$s2,-7 bne $t0,$0,SymmetryNumber addi $s5,$0,0 #check=0 addi $s4,$0,1 #i = 1 Cp_A_Loop: slt $t0,$s4,$s0 #i<a i>=a thi thoat i<a beq $t0,$0,Cp_A_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat mult $s4,$s4 # a*a mflo $s6 #temp = a*a bne $s6,$s0,Cp_A_ExitIf addi $s5,$0,1 #check=1 j Cp_A_ExitLoop Cp_A_ExitIf: addi $s4,$s4,1 j Cp_A_Loop
  • 6. Cp_A_ExitLoop: beq $s5,$0,Cp_A_CheckIf li $v0,4 #print "A la so hoan thien" la $a0,True_Cp_A syscall j Cp_A_CheckElse Cp_A_CheckIf: li $v0,4 #print "A khong la so hoan thien" la $a0,False_Cp_A syscall Cp_A_CheckElse: addi $s5,$0,0 #check=0 addi $s4,$0,1 #i = 1 Cp_B_Loop: slt $t0,$s4,$s1 #i<a i>=a thi thoat i<a beq $t0,$0,Cp_B_ExitLoop # Tuc la a khong lon hon i(a<=i) thi thoat mult $s4,$s4 # a*a mflo $s6 #temp = a*a bne $s6,$s1,Cp_B_ExitIf addi $s5,$0,1 #check=1 j Cp_B_ExitLoop Cp_B_ExitIf: addi $s4,$s4,1 j Cp_B_Loop Cp_B_ExitLoop: beq $s5,$0,Cp_B_CheckIf li $v0,4 #print "A la so hoan thien" la $a0,True_Cp_B syscall j Cp_B_CheckElse Cp_B_CheckIf: li $v0,4 #print "A khong la so hoan thien" la $a0,False_Cp_B syscall Cp_B_CheckElse: j Exit SymmetryNumber: addi $t0,$s2,-8 bne $t0,$0,Exit
  • 7. addi $s3,$0,0 #dao=0 add $s4,$s0,$0 #m=a Dx_A_Loop: slt $t0,$0,$s4 #0>=m thi 0, 0<m thi 1 beq $t0,$0,Dx_A_ExitLoop # 0<=m thi thoat addi $s7,$0,10 # $s7 = 10 mult $s3,$s7 # dao*10 mflo $s3 # dao=dao*10 div $s4,$s7 mfhi $s6 # temp = m % 10 add $s3,$s3,$s6 # dao = dao + temp div $s4,$s7 mflo $s4 j Dx_A_Loop Dx_A_ExitLoop: bne $s3,$s0,Dx_A_CheckIf li $v0,4 la $a0,True_Dx_A syscall j Dx_A_CheckElse Dx_A_CheckIf: li $v0,4 la $a0,False_Dx_A syscall Dx_A_CheckElse: addi $s3,$0,0 #dao=0 add $s4,$s1,$0 #m=a Dx_B_Loop: slt $t0,$0,$s4 #0>=m thi 0, 0<m thi 1 beq $t0,$0,Dx_B_ExitLoop # 0<=m thi thoat addi $s7,$0,10 # $s7 = 10 mult $s3,$s7 # dao*10 mflo $s3 # dao=dao*10 div $s4,$s7 mfhi $s6 # temp = m % 10 add $s3,$s3,$s6 # dao = dao + temp div $s4,$s7 mflo $s4 j Dx_B_Loop Dx_B_ExitLoop:
  • 8. bne $s3,$s1,Dx_B_CheckIf li $v0,4 la $a0,True_Dx_B syscall j Dx_B_CheckElse Dx_B_CheckIf: li $v0,4 la $a0,False_Dx_B syscall Dx_B_CheckElse: j Exit Exit: li $v0, 10 syscall