I am coding in ARM assembly and C coding languages. I need four functions in Assembly language that I can invoke from my C code.
- Addition, Subtraction, Division, and multiplication of two numbers from the users input in c
Here is my C code that these functions will have to be invoked from, thank you.
C:
#include int addition (int var1, int var2); void main() { int loop = 1; //loop var. for the while loop check char operator, input; float num1, num2, result; while(loop == 1) //While loop check to be continuous until loop var. altered { printf("************************************************** "); //Visual representation printf(" The Best Calculator "); //of the calculator on printf("************************************************** "); //the terminal printf("Input:first number|operator|second number|[ENTER]: "); printf("Example: 10+20 [Enter]: "); printf("************************************************** "); scanf(" %f %c %f", &num1,&operator,&num2); printf(" "); if(operator == '+') { result = num1 + num2; printf("Addition: %.2f + %.2f = %.2f", num1, num2, result); } else if (operator == '-') { result = num1 - num2; printf("Subtraction: %.2f - %.2f = %.2f", num1, num2, result); } else if (operator == '*') { result = num1 * num2; printf("Multiplication: %.2f * %.2f = %.2f", num1, num2, result); } else if (operator == '/') { result = num1 / num2; printf("Division: %.2f / %.2f = %.2f", num1, num2, result); } else { printf("Invalid operator please input +, -, *, / "); } printf(" "); //Spacing printf("Continue? "); //Inquiry to continue using the calculator printf("(Y/N): "); scanf(" %c", &input); if (input == 'N' || input == 'n') { loop = 0; } printf(" "); //Extra spacing at end for visual clarity } //end while //return 0; }