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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started