part-1selecting array elements implement the


Part-1

Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume 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

Part-2

Greatest Common Divisor (GCD) The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves integer division in a loop, described 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 Implement this function in assembly language and write a test program that calls the function several times, passing it different values. Display all results on the screen.

Part-3

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 that 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.

Solution Preview :

Prepared by a verified Expert
Computer Engineering: part-1selecting array elements implement the
Reference No:- TGS0442386

Now Priced at $30 (50% Discount)

Recommended (94%)

Rated (4.6/5)