Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This lab will introduce you to reading input from the commandline and storing it on the stack. As part of this, you'll learn about the
This lab will introduce you to reading input from the commandline and storing it on the stack. As part of this, you'll learn about the stack pointer sp how the stack is indexed, and how the scanf function works. In sum.s write code the uses scanf that puts the numbers in inputtxt onto the stack and computes the sum of these numbers. As usual, the code can be compiled like this: armc sum.s To read in the numbers, you can pipe them into the binary as follows: about inputtxt Once you have finished writing sum.s make a copy of the file, rename it average.s and modify it so that it computes the average of the numbers in inputtxt Note: In order to divide by the number of elements in this case a power of you can use an arithmetic shift right to divide. Shifting all the bits of a binary number to the right changes the value of the number as a whole. Since each bit's position represents a power of two, shifting all the bits to the right once is the same as dividing the number by two. This should help you figure out how many bits you have to shift by to compute the
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