ANSWER :
.LC0:
.string "Inset the first number: "
.LC1:
.string "%d"
.LC2:
.string "\nFirst number is not in range :"
.LC3:
.string "\nInset the first number: "
.LC4:
.string "\nInset the second number: "
.LC5:
.string "\nSecond number is not in range :"
.LC6:
.string "\nThe sum is: %d\nThe product is: %d"
main:
push rbp
mov rbp, rsp
sub rsp, 16
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
lea rax, [rbp-12]
mov rsi, rax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call scanf
mov eax, DWORD PTR [rbp-12]
cmp eax, 9
jle .L2
mov eax, DWORD PTR [rbp-12]
cmp eax, 255
jle .L3
.L2:
mov edi, OFFSET FLAT:.LC2
mov eax, 0
call printf
mov edi, OFFSET FLAT:.LC3
mov eax, 0
call printf
lea rax, [rbp-12]
mov rsi, rax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call scanf
.L3:
mov edi, OFFSET FLAT:.LC4
mov eax, 0
call printf
lea rax, [rbp-16]
mov rsi, rax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call scanf
mov eax, DWORD PTR [rbp-16]
cmp eax, 9
jle .L4
mov eax, DWORD PTR [rbp-16]
cmp eax, 255
jle .L5
.L4:
mov edi, OFFSET FLAT:.LC5
mov eax, 0
call printf
mov edi, OFFSET FLAT:.LC4
mov eax, 0
call printf
lea rax, [rbp-16]
mov rsi, rax
mov edi, OFFSET FLAT:.LC1
mov eax, 0
call scanf
.L5:
mov edx, DWORD PTR [rbp-12]
mov eax, DWORD PTR [rbp-16]
add eax, edx
mov DWORD PTR [rbp-4], eax
mov edx, DWORD PTR [rbp-12]
mov eax, DWORD PTR [rbp-16]
imul eax, edx
mov DWORD PTR [rbp-8], eax
mov edx, DWORD PTR [rbp-8]
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov edi, OFFSET FLAT:.LC6
mov eax, 0
call printf
mov eax, 0
leave
ret
OUTPUT :
Easy 68k code - assembly language Write a 68K program that reads two integers (>10 and...
Write a C program as follows: Single source code file Requests the user to input two integer numbers Requests the user to make a choice between 0 (add), 1 (subtract), or 2 (multiply) Declares three separate functions Uses a pointer to these three functions to perform the requested action Outputs the result to the screen Submit your program source code file to this assignment. Sample Output Enter first integer number: 15 Enter second integer number: 10 Enter Choice: 0 for...
6. Consider a C program that reads two real numbers from the keyboard followed by a character where the character can be one of the operators +,-, *, 1, or % providing the addition, subtraction, multiplication, division, or remainder respectively. Then the result is displayed on the screen For example, if the user types 2.0 3.0 % then your code will display: Note: In the above example the inputs are real numbers but the remainder only performs an integer operation....
Code in assembly language please "Write an assembly 32 bit program that adds two numbers (other than 5 and 6) and stores the value to a variable called 'sum'. Also, use a block COMMENT to depict the name and description of the program, author of the program, and date."
MUST BE PROCEDURAL CODE. Write a program in C++ that reads two matrices and: 1) adds them (if compatible) and prints their sum, 2) subtracts them (if compatible) and prints their difference, and 3) multiplies them (if compatible) and prints their product. Prompt the user for the names of two matrix input files (see format below) and place the output in a file of the user’s choosing. The format of the input files should contain the number of rows, followed...
Task 1 : Write a Java program that prompts for and reads 10 integers from the user into an integer array of size 10, it then: - calculates the sum and average of positive numbers of the array and displays them. [Note: consider 0 as positive] Note: The program must display the message: "There are no positive values" if the array does not contain any positive value.
Write an assembly language program to do the following, and run it and test it on the lab simulator: Read in integers until a zero is read in. Keep a total of both the quantity and the sum of the negative integers and the positive integers. Once a zero is read in (signifying the end of the input) then: • If there were more positive than negative integers, or an equal number, print out a 0 and the sum of...
You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using “a la russe” multiplication. The program must display your banner logo as part of a prompt to the user. The valid range of values is 0 to 6000. You may assume that the user will always enter numerical decimal format values. Your program should check this numerical range (including checking for negative numbers) and reprompt the user for...
need the code in .c format #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> struct _cplx double re, im; // the real and imaginary parts of a complex number }; typedef struct _cplx Complex; // Initializes a complex number from two real numbers Complex CmplxInit(double re, double im) Complex z = { re, im }; return z; // Prints a complex number to the screen void CmplxPrint(Complex z) // Not printing a newline allows this to be printed in the middle of...
Write a program that reads a matrix from the keyboard and displays the summations of all its rows on the screen. The size of matrix (i.e. the number of rows and columns) as well as its elements are read from the keyboard. A sample execution of this program is illustrated below: Enter the number of rows of the matrix: 3 Enter the number of columns of the matrix: 4 Enter the element at row 1 and chd umn 1: 1...
Step 1. Write a program in assembly language (using macros) to print out the following messages on the screen [20 marks]: Hello, programmers! Welcome to the world of, Linux assembly programming! Step 2. Write a C function to passed two numbers to the function and calculate the sum of all the numbers between them (both inclusive). [50 marks] a. Make a version with for loop b. Make a version with while loop c. Make a version with do.. while loop...