Question

Write a machine language program to input two one-digit numbers, add them, and output the one-digit sum. There can be no space between the two one-digit numbers on input. Write the program in a format suitable for the loader and execute it on the Pep/9 simulator. It needs to be in hexadecimal, I am just confused on how to input numbers on the PEP/9 machine.

Answer #1

**Greetings!!**

**Code:**

**BR MAIN ;Branch to main program**

**PROMPT: .ASCII "PLEASE ENTER THE NUMBERS\X00" ;prompt
message**

**N1: .BLOCK 1 ;variable for number 1**

**N2: .BLOCK 1 ;variable for number 2**

**SUM: .BLOCK 1 ;variable for storing sum**

**MAIN: STRO PROMPT,D ;prompt the message on to the
screen**

**DECI N1,d ;read first number from the user**

**LDA N1,D ;load first number to accumulator**

**DECI N2,D ;read second number from the user**

**ADDA N2,D ;addd accumulator content with second number
ie add both the numbers**

**STA SUM,D ;store the answer to the variable
SUM**

**DECO SUM,D ;display sum**

**STOP ;stop**

**.END**

**Output screenshot:**

Hope this helps

(Write in C++)
Write a program that reads in two numbers and, if the
input is valid, outputs 2 times the product of the integers that
lie between the two values (including the values themselves). If
either number is not an integer, or if the first number is not less
than the second number, just output an error message. The sample
runs below should give the idea. User inputs are in bold. Important
Notes: Your program should use a loop...

How to write a C++ program.
Additive persistence is a property of the sum of the digits of
an integer. The sum of the digits is found, and then the summation
of digits is performed creating a new sum. This process repeats
until a single integer digit is reached. Consider the following
example:
1. The beginning integer is 1234
2. Sum its digits is 1+2+3+4 = 10
3. The integer is now 10
4. The sum of its digits is...

WRITE C++ PROGRAM FOR 1,2,3,4 PARTS of question,
DO ADD COOMENTS AND DISPLAY THE OUTPUT OF A RUNNING COMPILER
QUESTION:
1) Fibonacci sequence is a sequence in which every number after
the first two is the sum of the two preceding ones. Write a C++
program that takes a number n from user and populate an array with
first n Fibonacci numbers.
For example:
For n=10
Fibonacci Numbers: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
2):
Write...

Write spim program and execute it on mars. Your program reads
two integer values x and y. Write a function called sum that gets x
and y passed as parameters and return the sum of odd values between
x and y inclusive. In addition write another function called even
that gets x and y as parameters and returns the count of all even
numbers between x and y inclusive. Also in main print the quotient
and remainder of diving y...

IN C LANGUAGE
This program initially reads two integers from standard input:
(1) an integer T and (2) a positive integer N. It then reads N
integers and counts the numbers that are greater than T and the
numbers than are less than T. It then prints out these two
counts.
Example
What is the threshold value?
7
How many values?
5
Enter 5 values:
6 7 9 9 8
3 values are greater than 7
1 values are less...

Using Windows 32 framework , write an assembly
language program;
Write a recursive procedure to find the greatest
common divisor of
two non negative numbers. You should use Euclidean algorithm and
this is typically
discussed in CSC 230. Your procedure:
❼ Needs to follow cdecl protocol.
❼ Needs to take two parameters.
❼ Should return -1, if the parameters are negative.
❼ Should return gcd, if the parameters are non negative.
Your main procedure should do the followings.
❼ Read...

Write a python program that does the
following:
Prompts the user for three numbers in one request.
Be sure to specify the “delimiter” by which a user enters those
three numbers.
Divides the first number by the second number and add that result
to the third number.
Prints output that shows in one line the formula applied and the
result of the calculation.
Validate input by:
• Checking the user
entered 3 values
• Appropriately
checking for the following errors:...

C LANGUAGE CODE WITH COMMAND-LINE ARGUMENTS (NO
SCANF TO BE USED )
Q]. Write a program that displays all
the prime numbers in the given array with the following
constraint.
Constraint: Only those prime numbers should be
displayed whose location is a composite number.
Although you may have several prime numbers in the array, only
those prime numbers should be displayed which are stored at
non-prime locations. Remember that the first position in an array
corresponds to the location/index 0....

Write pseudocode for a simple algorithm for addition of two
n-digit numbers (one of
them could be < n digits with 0's appended to the
left) in base-10, as follows. Assume
the digits are stored in arrays A and B, with A[1] and B[1] being
the rightmost digits and
A[n] and B[n] being the leftmost digits. Use a for loop to go from
right to left adding the
digits and keeping track of the carry. Now, here's the real
task:...

A state's Department of Motor Vehicles needs a program to
generate license plate numbers. A license plate number consists of
three letters followed by three digits, as in CBJ523. (So "number"
is a bit inaccurate, but that's the standard word used for license
plates). The plate numbers are given out in sequence, so given the
current number, the program should output the next number. If the
input is CBJ523, the output should be CBJ524. If the input is
CBJ999, the...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 6 minutes ago

asked 15 minutes ago

asked 21 minutes ago

asked 21 minutes ago

asked 23 minutes ago

asked 27 minutes ago

asked 33 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago