Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions