Part-1selecting array elements implement the following c

Assignment Help Computer Engineering
Reference no: EM13346875

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 <ArraySize ) { if( array[index] <= sample ) {  sum += array[index]; } index++; } Optional: show a flowchart of your code.

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.

Reference no: EM13346875

Questions Cloud

Prepare a marketing plan for one or two new products in : prepare a marketing plan for one or two new products in your own business andor another business in your country or
To design a class-based solution to a problem using : to design a class-based solution to a problem using multiple data structures.the problemwrite a program to help an
Implementation in matlab under windows to open a named pipe : implementation in matlab under windows to open a named pipe and to read data from the pipe an other program writes into
We have selected a case study from the university of hong : we have selected a case study from the university of hong kong wal-mart in china 2012. this is an updated case on
Part-1selecting array elements implement the following c : part-1selecting array elements implement the following c code in assembly language using the block-structured .if and
Purchased merchandise from abilene company for 6000 under : purchased merchandise from abilene company for 6000 under credit terms of 110 n30 fob destination invoice dated august
When a process enters the cpu your program must now forkand : when a process enters the cpu your program must now forkand exe a stand alone child process. you must use glxgears for
Leadership and transformationhow does your transformational : leadership and transformationhow does your transformational experience illustrate - or refute - a leadership
You are the nal voter in a brand new start-up league the : you are the ?nal voter in a brand new start-up league the ultra fun foosball league uffl. the directors are looking to

Reviews

Write a Review

Computer Engineering Questions & Answers

  Which of following statements is true

Which of following statements is true

  Defining the class counter

Write down the definition of the class counter consisting of: An instance variable named counter of type int. A constructor which takes one int argument and allocates its value to the counter.

  How to develop a problem definition

How to develop a problem definition

  Facilitate requirement elicitation, specification

What process or tools are you familiar with that facilitate requirements elicitation, specification and decomposition?

  What devices use to get efficient network communication

CNT Books has expanded considerably as you first got network up and running three years ago. It at the present occupies an entire floor in building, and its LAN has full-grown to contain several servers and more than 60 workstations.

  How to illustrate a memory map for a system

Illustrate a memory map for a system with a memory capability of 512MB. Each memory location in system is 8 bits.

  What variety of cable will work to make an association

What variety of cable will work to make an association

  Generating the printstream object

Generate a PrintStream object utilizing the dos and allocate the resulting reference to ps, a PrintStream variable which has already been declared.

  The algorithms of the parallel and perspective projection

I have a java application that reads in a vertex list and face list. I also have code to write 2-D lines and ouput that image file. In my code I have the standard 3D default values defined for: PRP and VRP reference points, VPN and VUP vectors, an..

  Database management

Additionally to limiting the actual tables or columns that a user has access to, you may also limit what the user does. Specify some of the ROLES you could allocate to the users and what would these roles do?

  Do you need to set up a new case for the hospitalization

A patient has been seeing the doctor regularly for treatment of diabetes. She was hospitalized yesterday, and the doctor saw her in the hospital for treatment of her diabetes. Do you need to set up a new case for the hospitalization

  Unix and window trace route

Compare and contrast some of the differences between the UNIX (and Linux) and the Window Trace route. All codes for each ICMP error message are not fully listed and described.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd