Question: Convert this C code to MIPS. Preferably allow it to run in Mars or QTSpim please! #include int main() { printf(Welcome to the MIPs basic

Convert this C code to MIPS.

Preferably allow it to run in Mars or QTSpim please!

#include

int main()

{

printf("Welcome to the MIPs basic calc! ");

printf("Please enter the first number. ");

int num1=0, num2=0, type;

int result=0;

scanf("%d", &num1);

printf("Please enter the second number. ");

scanf("%d", &num2);

printf("Enter the operation type: ");

scanf("%d", &type);

if(type == 0)

{

result=num1+num2;

}

else if(type == 1)

{

result=num1-num2;

}

else if(type == 2)

{

result=num1*num2;

}

else

{

printf("Incorrect operation type.");

}

printf("The result is: %d ", result);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!