Question #251631

Write an assembly language program that uses 3 byte variables, a, b, and c. The variable are initialized before the program starts with the values 2, 5, and 0, respectively. The program will add, sub, divide and multiply the contents of the variable a to that of b and store the result into c. Only c will change.


Expert's answer

#include <stdio.h>
int a=2;
int b=5;
int c=0;
int main()
{
    c=a+b;
    printf("Addition: %d\n",c);
    int subtract=b-a;
    c=b-a;
    printf("Subtraction: %d\n",c);
    double divide=b/a;
    c=b/a;
    printf("Division: %.2f\n",divide);
    c=b*a;
    printf("Multiplication: %d\n",c);
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS