Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 584 Bytes

File metadata and controls

33 lines (23 loc) · 584 Bytes

Exercises

  1. Convert the following C code to MIPS

    #include <stdio.h>
    
    int main()
    {
    	float price;
    	double golden = 1.618;
    	int ret;
    
    	printf("Enter what the price of gas was last time you filled up: ");
    	scanf("%f", &price);
    
    	printf("%f is too expensive!\n", price);
    
    	printf("The golden ratio is roughly %f\n", golden);
    
    
    	printf("Enter an integer for the program to return: "
    	scanf("%d", &ret);
    	return ret;
    }
  2. Write a program that asks the user for their name, reads it in, and then prints "Hello [user’s name]!"