`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
INPUT
/Read a number n. where n stores inot AC
JNS FindSum
/Call FindSum by passing n
OUTPUT
/Print the return
value(sum)
HALT
/Exit the program
FindSum, HEX 000
/Store the return address
STORE n
/Save the passed value into
n
LOOP, SKIPCOND 800
/if n is 0,
go to Return
JUMP Return
/Do sum=sum+n
LOAD sum
/AC=sum
ADD n
/AC=sum+n
STORE sum
/sum=AC
/DO n=n-1
LOAD n
/AC=n
SUBT ONE
/AC=n-1
STORE n
/n=AC
JUMP LOOP
/Go to LOOP
Return, LOAD sum
/Send sum as return value
JUMPI FindSum /Return
from FindSum
/Declare necessary variables
n, DEC 0
sum, DEC 0
ONE, DEC 1
Below is the process to run it
Open MARIE Simulator
Open File editor
Write the program
Save the program as sumoneton.mas
Assemble the program
Now load the program(sumoneton.max)
Note: Set INPUT ,AC and OUTPUT display format as Dec (Decimal number)
Run the program
Input: enter n=5
Ouptut: sum=1+2+3+4+5= 15
Kindly revert for any queries
Thanks.
Write a MARIE program that sums the numbers from 1 to N (N(N + 1) /...
2. Write a Marie program that accepts two positive (inputs) two integers and outputs the sum of both of the integers and all the numbers in between Write a Marie program that determines the largest of a series of positive integers provided by a user. The user will enter a -1 when she is finished. Up to 10 numbers will be provided by the user. Write a Marie program that accepts two positive integers, multiples them by repeated addition, and...
1. Write a MARIE program that can implement a sum of two products, i.e. using MARIE program to calculate 13*35 + 27*18 (* means multiply) and store the result to a variable Sum. Hint: e.g. following code can be used to initialize the variables A, B, C and D, in which A is 13, B is 35, C is 27 and D is 18 A, DEC 13 /one of the four input numbers: 13 B, DEC 35...
In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read. Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. version1: use a while loop. version2: use a do-while loop. version 3: use a for loop. For each version, use a loop to input 10 int numbers from the user...
Write a MARIE program to implement one round of rock paper scissors game. Your program should represent the three moves ‘rock’, ‘paper’ and ‘scissors’ with numbers 1, 2 and 3 respectively. When the program is run, there should be two input prompts, one after the other, to ask for player 1’s and player 2’s moves (a number 1, 2 or 3). Then the program would compare both numbers and apply the following rules to work out the winner. Paper beats...
Write a MARIE assembly program to read two different positive numbers from the keyboard and output the smaller number to the screen.
Program 6: Sums and Averages. Assigned Wednesday, 10/05/16 Program Due Wednesday, 10/12/16 , at start of class. Write a program in c++ that asks the user to input a list of numbers, one at a time, until the user is finished. The program should keep track of how many numbers, how many positive numbers, and how many negative numbers were entered. It should also calculate the sums for each of these (positives, negatives, and total). After exiting the loop, the...
Write a java program that will print if n numbers that the user will input are or not within a range of numbers. For that, your program needs to ask first for an integer number called N that will represent the number of times that will ask for other integer numbers. Right after, it should ask for two numbers that will represent the Min and Max for a range. Lastly. it will iterate N number times asking for an integer...
textbook solution does not appear correct. Write a MARIE program using a loop that multiplies two positive numbers by using repeated addition. For example, to multiply 3 × 6, the program would add 3 six times, or 3 + 3 + 3 + 3 + 3 + 3.
In this exercise, write a complete Java program that reads integer numbers from the user until a negative value is entered. It should then output the average of the numbers, not including the negative number. If no non-negative values are entered, the program should issue an error message. You are required to use a do-while loop to solve this problem. Solutions that do not use a do-while loop will be given a zero. Make sure to add appropriate comments to...
using c++ write a program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: 1. Output the sum of all even numbers