Question

Translate the following c++ code into pep/9 assembly language.

#include <iostream>
using namespace std;
int square(int n){
    int i;
    int sq;
    sq = 0;

    for (i = 0; i < n; i++){
        sq = sq + n;     }

    return sq;
}

int main (){
    int num;

    cout << "Enter a number: ";
    cin >> num;


    cout << num << " squared = "
         << square(num)
         << endl;

    return 0;
}

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Consider a hybrid sorting algorithm that combines Mergesort with Insertion Sort.It uses Mergesort un...

A: Actually, Algorithm is a step by step process. 

Q: **PLEASE USE C#**Create a program named TipCalculation that includes two overloaded methods named Di...

A: The required C# code is given below:   using System;class TipCalculation {    // method that accept ...

Q: Computer Science Question

A: The, answer has given below:

Q: Q3: Convert the following while loop into a do-while loop. int number; int sum = 0; count&lt;&lt; "E...

A: Click to see the answer

Q: A set of ten BCD readings is stored in the ML 2050H. Write an ALP for 8085 to convert the numbers in...

A: Algorithm – Load 00H in a register (for carry) Load content from memory into register pair Move con...

Q: C++ Using Card and Deck class created during the lecture or your own implementation that follows the...

A: The, given information is: game is designed for a single player who is playing against the computery...

Q: Subject :database

A: The following properties are required to solve the problems in the given scenario: Atomicity, Consis...

Q: Clustering is a side effect of linear probing. Group of answer choices True False

A: True

Q: (d) create_area_dict(list2D) that takes a 2D-list containing the database as input and creates a dic...

A: def create_area_dict(database):    d={}    for i in range(len(database)):        key=database[i][0] ...

Q: A substring of a string is a contiguous sequence of characters from the string. For example, BC is a...

A: import java.util.*;class Test134 { public static void main(String args[]) {  Scanner sc = new Scanne...

Q: 2- Please I want solution of this question urgently. Thanks

A: Explanation: a. c++ is not same as c = c + 2 because, c++ means the value of “c” is incremented by 1...

Q: Consider the following set of functional dependency for the relation schema R = (А, В, С, D, E, F, G...

A: Functional Dependency: A functional dependency refers to the connection between any two fields of a ...

Q: ) In order to communicate between devices inside a computer. A wire routing scheme is needed such th...

A:                         A bus is a shared connection for communication. To link multiple subsystems...

Q: Two elements with identical keys should have the same hash code. Group of answer choices True False

A: The, answer has given below:

Q: Compiler Construction

A: Actually, compiler is a special program that turns the code into machine language.

Q: 12) Write a program to (a) load the accumulator with the value AAH, and (b) compliment the ACC 2100 ...

A: Based on our rule, we should do the first question alone when multiple questions are posted. Please ...

Q: Explain the benefit of hierarchical routing in terms of scale and administrative autonomy.

A: Scale - As the number of routers becomes large, the overhead involved in computing, storing, and com...

Q: How can I change the " if" to fit the condition : "Determine the number of sixes in each group "  im...

A: Given code: import java.util.Arrays;public class DimArray { public static void main(String[] args) {...

Q: Question 2Can we have option for Rewritable Optical Discs? If we have so how could this possible to ...

A: Solution: A electronic data storage medium which an write and read data  with the help of low-powere...

Q: Write a C program, called msg.c, that reads messages from an input file (or stdin) and verifies whet...

A: C programming is a general-purpose, procedural, imperative computer programming language developed i...

Q: // Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from...

A: #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int ...

Q: Problem 2 (. ). Consider the following heap, which shows integer keys in the nodes: 5 22 15 34 27 28...

A: Remove the minimum from a given heap i.e 5 Copy the last value in the heap to the root of the heap....

Q: Write a program for 8085 microprocessor the following function. F = X2 – 2X+5. Where X £ 5.

A: 25 - 10 +5 20Ans

Q: please answer to number 1  thank youu

A: a) f(n) = 11.2+12.3+...+1n(n+1)f(1) = 11.2 is TrueLet f(k) is truef(k) = 11.2+12.3+...+1k(k+1) =k --...

Q: I* Your solution goes here */ while

A: The given is a java code under file named AutoBidder with below functionality:   1. It has a nextBid...

Q: Write a c++ program to calculate the answer of a quadratic equation. Take necessary inputs from the ...

A: Program approach: The quadratic equation is is given by Ax2 + Bx + C = 0  Read in the input values ...

Q: A string of readings is stored in memory locations starting at XX70H, and the end of the string is i...

A: Algorithm: step 1. Load the BYTE1 in accumulator to register B step 2. Subtract the 50H from the acc...

Q: Now analyze the above execution and determine whether the deadlock hasoccurred or not.If occurs,then...

A: After analyzing the above transactions T1, T2 and T3 , T2 is dependent on T1 because it is reading t...

Q: Search online for samples of IT contracts. Use search phrases like “IT contract” or “sample contract...

A: The, given information is: Search online for samples of IT contracts. Use search phrases like “IT co...

Q: 2. Modify the Fahrenheit program so that it displays a button that when pressed causes theconversion...

A: Actually, java is a object oriented programming language. It is a platform independent.

Q: Draw the diagram of given addressing mode. Show it with examples also. 1-  Register Indirect Address...

A: Here, in this addressing mode, the register value acts as the address of the memory where the operan...

Q: please use c++ to answer the following question Use inheritance and classes to represent a deck of p...

A: Actually, inheritance is a acquiring the properties from one class to another class.

Q: This is the question -  In Chapter 2, you created an application named QuartsToGallonsInteractive th...

A: InputMismatchException occurs when the number entered by the user is of a different data type than t...

Q: Please explain RAID 10 and RAID 50.

A: In RAID 1 all data written to one disk is mirrored to its counterpart in the pair. RAID 10 takes thi...

Q: Computer Science Question

A: Click to see the answer

Q: Using an unsorted array to implement a map would allow an O(log2N) get operation (where N is the num...

A: False Loop will run array n times and Second loop again n times Nested Loop

Q: What is the significance of empowerment technologies?

A: Empowerment Technology -  Empowerment of technologies ia very important because it make the work of ...

Q: How can i find the largest word in 2D array in java

A: Java Code:   public class Main { public static void main(String[] args) { String names[][]...

Q: Write a python program that lets the user play the game of Rock, Paper, Scissors against the compute...

A: #Rock, Paper, Scissors Game import random while True: choice=int(input("Enter your choice 1.Rock, 2...

Q: Let L = {0" : n > 1 and n mod 3 + 0}. Give the transition diagram of a Standard Turing Machine for L...

A: Solution is in Step 2.

Q: A robot is placed at the origin of a 2D coordinate plane (i.e. position (0, 0)). The robot is given ...

A: A coordinate plane is a two-dimensional plane formed by the intersection of a vertical line called y...

Q: Data Point F1 F2 P1 P2 1.5 1.5 P3 2 1.5 P4 1.5 P5 4.5 2 P6 2.5 7.0

A: Actually, given data set is: Data Point X Y P1 1 2 P2 1.5 1.5 P3 2 1...

Q: Description You are contacted by a Birthday Party Clubownerwho wants you to help withmaking a Websit...

A: Click to see the answer

Q: North Hills College is a private college in a small Candyland town. The college has outgrown itscomp...

A: Answer: Features offered by the computerized screening system are as follows:  Based on various fac...