Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Order of operations (Challenge Assignment) create a program that calculates the

ID: 3594639 • Letter: O

Question

Order of operations (Challenge Assignment) create a program that calculates the following expression: answer = (A + B) – (C+ D)

• The answer must be stored In a variable of the correct data type given your data (A, B, C, D)

• The values for your data (A, B, C, D) must be stored In registers (e.g., eax, ebx). not variables • You must supply the initial values for the data (A, B, C, D)

• Create a string that could accompany the answer in an output statement (e.g., “The answer is:"). You do net have to output the String.

• Comment each line of code. as demonstrated in the Working Examples Section Program 3.2 for GAS, to briefly describe each line's meaning

Explanation / Answer

#include <stdio.h>

int main(void){

register int A;//register

register int B;//register

register int C;//register

register int D;//register
int val = 0;//variable to take value and load into register
printf("Enter value of register A ");

scanf("%d", &val);
A = val;//loading value of val to register
printf("Enter value of register B ");

scanf("%d", &val);
B = val;//loading value of val to register
printf("Enter value of register C ");

scanf("%d", &val);
C = val;//loading value of val to register
printf("Enter value of register D ");

scanf("%d", &val);
D = val;//loading value of val to register
printf("The answer is: %d",(A + B ) - (C + D));//calculating expression
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote