Computer Science Illuminated
Computer Science Illuminated
7th Edition
ISBN: 9781284155617
Author: Nell Dale, John Lewis
Publisher: Jones & Bartlett Learning
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 6, Problem 47E

Explanation of Solution

Pseudocode:

The pseudocode to print the sum of four values is as follows:

  Set Counter to 0

  Set Sum to 0

  WHILE Counter < 4

        Read Number

        Add Number to Sum

        Set Counter to Counter + 1

  Write Sum

Explanation:

In the above pseudocode,

  • First, read the four input values from the user.
  • Then, use a “WHILE” loop to calculate the sum of four input values.
  • Finally, write the sum on the screen.

Assembly-language program:

The assembly language program to write the sum of four input values is as follows:

SymbolMnemonicsOperandComment
 BRMain; Branch to the location Main
Sum:.WORD0X0000; Set up the value of the Sum to 0
Counter:.WORD0X0000; Set up the value of the Counter to 0
Limit:.WORD0X0004; Set up the value of the Limit to 4
Number:.BLOCK2; Set up a two byte block for Number
Main:LDASum,d; Load the Sum value into the accumulator
 DECINumber,d; Read and store Number
 ADDANumber,d; Add the Number value with Accumulator
 STASum,d; Store the accumulator value into Sum
 LDACounter,d; Load the Counter value into accumulator
 ADDA1,i; Increment the Number by 1
 STACounter,d; Store the ...

Blurred answer
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY