In: Computer Science
What is the value stored in variable perimeter after the code has been executed? (6 pts)
.data
length: .word 16
width: .word 24
perimeter: .word 0
.text
la $s0, length
la $s1, width
la $s2, perimeter
lw $s3,0($s0)
lw $s4, 0($s1)
add $s3, $s3, $s3
add $s4, $s3, $s4
add $s5, $s3, $s4
sw $s5, 0($s2)
Perimeter:__________________________________________
la $s0, length //address of length stored in $s0
la $s1, width //address of width stored in $s1
la $s2, perimeter //address of perimeter stored in $s2
lw $s3,0($s0) //value of length stored in $s3 [ 16 ]
lw $s4, 0($s1) //value of width stored in $s4 [ 24 ]
add $s3, $s3, $s3 //add the value in $s3 & $s3 & store it in $s3 [ $s3=16+16 =32 ]
add $s4, $s3, $s4 //add the value in $s3 & $s4 & store it in $s4 [ $s4= 32+24 =56 ]
add $s5, $s3, $s4 //add the value in $s3 & $s4 & store it in $s5 [ $s5= 32+56 =88 ]
sw $s5, 0($s2) //Store the value in address of $s5 to $s2
=> Perimeter = 88
******************************************************************************************
PLEASE LIKE IT RAISE YOUR THUMBS UP
IF YOU ARE HAVING ANY DOUBT FEEL FREE TO ASK IN COMMENT
SECTION
******************************************************************************************