-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEx4.jar
105 lines (83 loc) · 1.12 KB
/
Ex4.jar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Nhap tu ban phím 2 so nguyên, tính tong, hieu, tích, thuong cua 2 so do.
.data
tb1: .asciiz "Nhap a: "
tb2: .asciiz "Nhap b: "
tb3: .asciiz "\nTong la: "
tb4: .asciiz "\nHieu la: "
tb5: .asciiz "\nTich la: "
tb6: .asciiz "\nThuong la: "
tb7: .asciiz "\nPhan du cua thuong: "
.text
#xuat tb1
li $v0,4
la $a0,tb1
syscall
#Nhap a, luu vao s0
li $v0,5
syscall
move $s0,$v0
#xuat tb2
li $v0,4
la $a0,tb2
syscall
#Nhap b, luu vao s1
li $v0,5
syscall
move $s1,$v0
Tong:
#xuat tb3
li $v0,4
la $a0,tb3
syscall
# tinh tong
add $s2,$s0,$s1
#xuat s2
li $v0,1
move $a0,$s2
syscall
Hieu:
#xuat tb4
li $v0,4
la $a0,tb4
syscall
# tinh hieu
sub $s3,$s0,$s1
#xuat s3
li $v0,1
move $a0,$s3
syscall
Tich:
#xuat tb5
li $v0,4
la $a0,tb5
syscall
# tinh tich
mult $s0,$s1
mflo $s4
#xuat s4
li $v0,1
move $a0,$s4
syscall
Thuong:
#xuat tb6
li $v0,4
la $a0,tb6
syscall
# tich thuong
div $s0,$s1
mflo $s5
#xuat s5
li $v0,1
move $a0,$s5
syscall
#xuat tb7
li $v0,4
la $a0,tb7
syscall
# tinh phan du
div $s0,$s1
mfhi $s6
# xuat s6
li $v0,1
move $a0,$s6
syscall