Write a MIPS assembly program for the following C program.
int fun (int x, int y);
int recur (int n);
int main(){
printf("input a: ");
scanf("%d", &a);
printf(“input b:”);
scanf("%d", &b);
printf("input c: ");
scanf("%d", &c);
int sum = 0;
sum = a * b + fun( a+1, b-1 ) ;
printf(“ans: %d\n”, sum);
sum += recur(c);
printf(“ans: %d”, sum);
}
int fun ( int x, int y ){
return ( x < y ) ? ( x*y + fun ( x+1, y-1 ) ) : 0 ;
}
int recur (int n){
if(n <= 0)
return 0;
else if (n == 1)
return 1;
else
return recur (n-1) + n;
}
1
Expert's answer
2016-10-25T05:08:45-0400
Dear stella, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment