(10 points) Translate the following algorithm into assembly language. IF 65 < X THEN X = 9+(X^2) ELSE X = - Y 3.
(10 points) Translate the following algorithm into assembly language. X=0 FOR K = I TO 5 X=X+5 END_FOR
4. (10 points) Translate the
following algorithm into assembly language. X=0 Y=5 Z=5 WHILE Z = 5
X=X+1 Y=Y-1 Z=X+Y
(10 points) Translate the following algorithm into assembly language. IF 65 < X THEN X = 9+(X^...
Write an ARM assembly language program to translate the following sequence of statements . Assume x and y are memory locations that store two unsigned integers. Use the following: x is in R1, y is in R2, and z in R3. Make sure that your program works for any value of x and y. if (x > 15) { x = 1; if (y > 15) { y = 2; } else { y =...
Write an ARM assembly language program to translate the following sequence of statements . Assume x and y are memory locations that store two unsigned integers. Use the following: x is in R1, y is in R2, and z in R3. Make sure that your program works for any value of x and y. if (x > 15) { x = 1; if (y > 15) { y = 2; } else { y =...
Translate the following C program to Pep/9 assembly language. It multiplies two integers using a recursive shift-and-add algorithm. mpr stands for multiplier and mcand stands for multiplicand. A recursive integer multiplication algorithm #include <stdio.h> int times(int mpr, int mcand) { if (mpr == 0) { return 0; } else if (mpr % 2 == 1) { return times(mpr / 2, mcand * 2) + mcand; } else { return times(mpr / 2, mcand * 2); } } int main() { ...
Translate the following C program to Pep/9 assembly language. #include <stdio.h> int main() { int number; scanf("%d", &number); if (number % 2 == 0) { printf("Even\n"); } else { printf("Odd\n"); } return 0; }
(10 points) Does the following algorithm terminate when x = 9? Show your work. def mystery (x): while (x != 1) : if (x % 2 == 0): X = x/2 else: x = 3 * x + 1
Translate the following C program to Pep/9 assembly language. #include <stdio.h> const int limit = 5; int main() { int number; scanf("%d",&number); while (number < limit){ number++; printf("%d",number); } return 0; }
7. Write the following code segment in MARIE's assembly language (If-Else): If x < Y Then X = Y - X; Y = Y + 1; Else X = Y; Y = 0; Endif;
1. Usually, there are many ways to translate a block of C code into assembly. It is always a good idea that you stick with your own way. Please translate the following code blocks into MIPS, where our convention is as follows: $SO stores integer x; $S1 stores integer y it (x>y+5) then xxy else y-x-y; while (x>y+5) x-; x-; y++h for (x=1; x<y: x++) {x-x+5 ; y++}
Convert this C++ language to PEP/8 assembly language. #include <stdio.h> int main(void) { int num, rem; printf("Enter a number: "); scanf("%d", &num); printf("Roman numerals: "); while(num != 0) { if (num >= 1000) // 1000 - m { printf("m"); num -= 1000; } else if (num >= 900) // 900 - cm { printf("cm"); num -= 900; } else if (num >= 500) // 500 - d { printf("d"); num -= 500; } else if (num >= 400) // 400 - cd { printf("cd"); num -= 400; } else if (num >= 100) // 100 - c { printf("c"); num -= 100; } else if (num >= 90) // 90 - xc { printf("xc"); num -= 90; } else if (num >= 50) // 50 - l { printf("l"); num -= 50; } else if (num >= 40) // 40 - xl { printf("xl"); num -= 40; } else if (num >= 10) // 10 - x { printf("x"); num -= 10; } else if (num >= 9) // 9 - ix { printf("ix"); num -= 9; } else if (num >= 5) // 5 - v { printf("v"); num -= 5; } else if (num >= 4) // 4 - iv { printf("iv"); num -= 4; } else if (num >= 1) // 1 - i { printf("i"); num -= 1; } } return 0;}
Translate the following C++ program to Pep/8 assembly language. Convert the given number into its roman numeral equivalent.class solution: def int_to_Roman(self, num): value = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ] symbol = [ "M", "CM", "D", "CD", ...