Question: In this part, we will write a program that adds up an array of integers. The array and the number of elements in the array

In this part, we will write a program that adds up an array of integers. The array and the number of elements in the array are stored in memory. Load the address of the array into a register, and the number of elements into another register. A third register will contain the sum. To get started, sketch out the code using Java (or some other language). However, you will need to use a while loop (instead of a for loop you know and love). The first part of the code will look like the following: COMP1200, Spring 2021, Park Lab Assignment 7 2 int num_elements = 8; int[] array = new int[num_elements]; R1 = array; R2 = num_elements; R3 = 0; // The sum while(/* some condition */ ) { } Chart your logic using a flowchart similar to the ones we did during class. Then use the provided skeleton code lab7-B.asm to add code so that your program computes to total value in R3. You may look at lab7-Bhints.asm for hints (this is the code that initialized an array to 7).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!