In: Computer Science
.data
#Declaring and Initializing A,B,C and D
variables
A: .word 20
B: .word 24
C: .word 12
D: .word 4
#Reserving space of 4 bytes to store the result of the
operation
result: .space 4
prompt: .asciiz "\nThe result
is: "
.text
main:
#Loading A,B,C and D variables from memory
lw $t0,A
lw $t1,B
lw $t2,C
lw $t3,D
mul $t4,$t0,2
#Multiplying A by 2
add $t4,$t4,$t1
#Adding B to the result in above operation
add $t5,$t2,$t3
#Adding C and D variables
div $t6,$t4,$t5
#Dividing ((2*A)+B) by (C+D)
sw $t6,result
#Storing result into memory
#Displaying the result to user
li $v0,4
la $a0,prompt
syscall
li $v0,1
move $a0,$t6
syscall