View the step-by-step solution to:



I am struggling with using MIPS and reading C. My professor gave this code and wants the

class to translate it to MIPS. The problem is- I don't know how to read C. Could you explain to me what the C program is supposed to do so I can understand my assignment?

#include <stdio.h>

int x;

int y;

int getInput(int min, int max);

int doubleIt(int x);

void printResult(char str[], int val);

int main(void) {

 printf("Hello Worldn");

 x = getInput(30, 40);

 y = doubleIt(x);

 printResult("Your final answer is ",y);

 return 0;


int getInput(int min, int max) {

 printf("Enter a number between %d and %d ", min, max);


 return x;


int doubleIt(int x) {

 return x + x;


void printResult(char *str, int val) {

 printf("%s %dn",str, val);


Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors