MARS MIP assembly language quesion
Write a program that reads 3 integers, print them, stores them, and add them together and print the result
Answer:
.data
A: .word # Integer A
B: .word # Integer B
C: .word # Integer C
S: .word #Integer S use to store the sum of A and B
Prompt1: .asciiz "Please enter first number A: "
Prompt2: .asciiz "Please enter second number B: "
Prompt3: .asciiz "Please enter third number C: "
Result: .asciiz "The sum of A, B and C in S is : "
.text
main:
#Prompt for integers A
li $v0, 4 # Load instruction for printing the string
la $a0, Prompt1 # Load Prompt1 into $a0
syscall
#Read first integer
li $v0, 5 # Read first integer A
la $t0, A
syscall
#Store first integer A into the memory
move $t0, $v0
sw $t0, A
##Prompt for integers B
li $v0, 4 # Load instruction for printing the string
la $a0, Prompt2 # Load prompt2 into $a0
syscall
#Read second integer
li $v0, 5 # Read second integer
la $t1, B # $t1 = B
syscall
#Store second integer into memory
move $t1, $v0 # Move contents in $v0 to $t0
sw $t1, B # B = value at $t1
##Prompt for integers C
li $v0, 4 # Load instruction for printing the string
la $a0, Prompt3 # Load prompt3 into $a0
syscall
#Read second integer
li $v0, 5 # Read second integer
la $t2, C # $t3 = C
syscall
#Store second integer into memory
move $t2, $v0 # Move contents in $v0 to $t2
sw $t2, C # C = value at $t2
#Add the three variables A, B and C and store it in S
la $t3, S # $t3 = S
add $t3, $t0, $t1 # $t3 = $t0 + $t1
add $t3, $t3, $t2 # $t3 = $t3 + $t2
sw $t3, S # S = value at $t3
#Display the Result prompt
la $a0, Result # Loads Output label to be printed
li $v0, 4 # Sysycall to print string
syscall
#Display the sum
lw $a0, S # $a0 = value at S
li $v0, 1 # Syscall to print integer
syscall
#Exit the program
li $v0, 10 # Load exit code to $v0
syscall
OUTPUT:
Please enter first number A: 3
Please enter second number B: 4
Please enter second number C: 2
The sum of A , B and C in S is : 9
Please give thumbsup, if you like it. Thanks.
MARS MIP assembly language quesion Write a program that reads 3 integers, print them, stores them,...
Easy 68k code - assembly language Write a 68K program that reads two integers (>10 and <225) of the keyboard, adds them together and multiplies them, writes the numbers and the results of addition and multiplication on the screen. If the numbers are not on the range, writes an error message and requests a new number. Example of the execution: Insert the first number: 10 Insert the second number:15 The sum is: 25 The product is: 150 Please take a...
Programming language is C++. 9. Write a program that reads digits and composes them into integers. For example, 123 is read as the characters 1, 2, and 3. The program should output 123 is 1 hundred and 2 tens and 3 ones. The number should be output as an int value Handle numbers with one, two, three, or four digits. Hint: To get the integer value 5 from the character '5' subtract '0' that is, '5'-'0'
2. Write an 80x86 assembly language program that reads byte size signed integers from memory and counts the number of zeros. Store this count in memory. End when you get a negative number. (20pts) For example: nums DB 4, 0, 0, 12, 6, 8, 0, 4, -1 count DB 0 after executing the procedure count should be 3 count DB 3.
write a program in x86 assembly language that sorts 10 integers entered from the keyboard and displays them in order
Write a Program in C language for: 1. Create a C program to read 7 integers and store them in an array. Next, the program is to check if the array is symmetric, that is if the first element is equal to the last one, the value of the second one is equal to the value of the last but one, and so on. Since the middle element is not compared with another element, this would not affect the symmetry...
Q#1 Write a C++ program that reads n integer values and stores them in an array of maximum 20 integers. Read from the user a valid value of n (n should not exceed 20). After reading the n array elements find the maximum and minimum elements.
Please write in Python language. Assignment 5 0 Write a program that reads in integers and then determines whether input value is prime number or not(using for statement) • First input Input number: 18457 yes . Second input Input number: 52 no
1.) (25 pts.) Write a MicroBlaze assembly language program that takes in a list of 10 integers and calculates and displays the mean (average) using floating-point instructions. Include in your HW submission a complete listing of your assembly code. 1.) (25 pts.) Write a MicroBlaze assembly language program that takes in a list of 10 integers and calculates and displays the mean (average) using floating-point instructions. Include in your HW submission a complete listing of your assembly code.
Question: WRITE A PROGRAM IN LC-3 ASSEMBLY LANGUAGE. DO NOT ... WRITE A PROGRAM IN LC-3 ASSEMBLY LANGUAGE. DO NOT USE PYTHON, JAVA, C or C++ or OTHERS. Your task is to write a program that counts the number of 1 bits of the value stored at location given by Datal. Your program should print the count (in hexadecimal, as it is easier) along with an appropriate heading. Test your program with the following values stored in Datal: a xFFFE...
Write an assembly language program that reads in a number, n, and outputs, Fibonacci number, F_n. Test your program on input 13. Turn in a listing of your program, and the results of this test run. (Your answer should be 233.)