My attempt in java int x[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int y[] = {1
ID: 3671839 • Letter: M
Question
My attempt in java
int x[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
int y[] = {1,20,30,40,5,60,70,80,90,10,110,120,130,140,15};
int i = 0;
int j = 0;
int sum = 0;
for(i = 0; i < x.length;i++){
for(j = 0; j < y.length; j++){
if(x[i] == y[j]){
sum += x[i];
}
}
}
(35 points) Say you wish to write a program that takes two integer arrays, X and Y, sums the corresponding element of each, and writes the result into a third array Z Each array has 15 elements. You know that the base addresses of X, Y, and Z are 0x00100000, 0x00200000, and 0x00300000, respectively-note that these addresses have not been loaded into any registers. Write MIPS assembly code that implement:s this programmExplanation / Answer
Hi below i have written a MIPS code for Suming of an integer and storing a result, Consider the following integer condition,
z = w + y; where z, w, and y are 4-byte, signed, two’s-complement, integers:
MIPS code:
la $t0, w # put address of w into $t0
lw $s0, 0($t0) # put contents of w into $s0
la $t1, y # put address of y into $t1
lw $s1, 0($t1) # put contents of y into $s1
add $s2, $s0, $s1 # add w + y, put result in $s2
la $t2, z # put address of z into $t2
sw $s2, 0($t2) # put contents of $s2 into z
//la = “load address” //lw = “load word” //sw = “store word”
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.