Question
I have CALCULATOR in C program will do addition , subtraction, multiplication, division, and variables to the power of max 10 . please use C
I have CALCULATOR in C program will do addition, subtraction, multiplication, division, and variables to the power of max 10.
please use C code below and translate into INTEL X-86 ASSEMBLY LANGUAGE( assembly.s) and call the assembly code function in to Main C function and will display output same as main C code please help.
#include
int main() {
//declare the variables int a,b,c,ch,i;
while(1) //LOOP FOREVER UNTIL A WRONG OPTION IS SELECTED { //Prompt the user for input printf("================================= "); printf("Welcome to the CALCULATOR please enter "); printf(" 1 for Addition 2 for subtraction 3 for multiplication 4 for division 5 for power operation "); printf("================================= "); printf("Enter the option: "); //Read OPTION scanf("%d",&ch);
if(ch==1) { //READ two numbers printf("Enter a and b: "); scanf("%d %d",&a,&b); //Perform operation c=a+b; //print the result printf("The addition of a and b is %d ",c); }
else if(ch==2) { //READ two numbers printf("Enter a and b: "); scanf("%d %d",&a,&b); //Perform operation c=a-b; //print the result printf("The subtraction of a and b is %d ",c); }
else if(ch==3) { //READ two numbers printf("Enter a and b: "); scanf("%d %d",&a,&b); //Perform operation c=a*b; //print the result printf("The multiplication of a and b is %d ",c); }
else if(ch==4) { //READ two numbers printf("Enter a and b: "); scanf("%d %d",&a,&b); //Perform operation c=a/b; //print the result printf("The division of a and b is %d ",c); }
else if(ch==5) { //READ two numbers printf("Enter base and power "); scanf("%d %d",&a,&b); while(b>10) { printf("Please enter power below 10. "); printf("Enter base and power "); scanf("%d %d",&a,&b); } //Perform operation c=1; //multiply a for b times for(i=1;i<=b;i++) c=c*a;
//print the result printf("The %d raised %d is %d ",a,b,c);
} else { printf("Invalid choice..!!"); break; } } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started