Question1)
Choose Array Elements to implement the following C++ code in assembly language, and use the block-structured IF and WHILE directives. Suppose that all variables are 32-bit signed integers: int array[] = {10,60,20,33,72,89,45,65,72,18}; int sample = 50; intArraySize = sizeof array / sizeof sample; int index = 0; int sum = 0; while( index
Question2)
Greatest common divisor (GCD) of two integers is the largest integer which will evenly divide both integers. GCD algorithm involves integer division in the loop, explained by the following C++ code: intGCD(int x, int y) { x = abs(x); y = abs(y); do { int n = x % y; x = y; y = n; } while (y > 0); return x; } // absolute value. Execute this function in an assembly language and write a test program which calls the function many times, passing it different values. Display all the results on the screen.
Question3)
Greatest Common Divisor Write a recursive implementation of Euclid’s algorithm for finding the greatest common divisor (GCD) of two integers. Descriptions of this algorithm are available in algebra books and on the Web. Write a test program which calls your GCD procedure five times, using the following pairs of integers: (5,20), (24,18), (11,7), (432,226), (26,13). After each procedure call, display the GCD.