Section 1 Using the MARS or SPIM simulator develop a program

Section 1: Using the MARS or SPIM simulator develop a program that will evaluate the following expression 3 n n* (n 1) 15 where n is stored in a data location and is set to 15. Your program should use the system calls to print the result and to exit the program. Section 2: Using the MARS or SPIM simulator develop a program that will implement the following conditional statement. If n is even) n /2 else n 3 n 1; In this case, n is to be input by the user (assume they input a non-negative value), the conditional is performed, and the resulting n is to be output. Again, use the system calls for input, output, and exiting the program Hint: There is a remainder pseudoinstruction for the MIPS architecture that you can use to determine if the value is even or odd or you can look at bit o to determine if the value is even or odd.

Solution

Section 4:

#include<iostream>

#include<stdio.h>

#include<stdlib.h>

using namespace std;

void main()

{

SubFunc(\"asha\", \"black\", \"IndianCricket\");

system.exit();

}

void SubFunc(string name, string color, string sports)

{

cout<<\"My name is \";

cout<<name<<endl;

cout<<\"My favourite color is \";

cout<<color<<endl;

cout<<\"My favourite sports team is \";

cout<<sports<<endl;

}

Section 5:

#include<stdio.h>

#include<stdlib.h>

using namespace std;

int main()

{

int num1, num2, num3;

cout<<\"enter two numbers:\";

cin>>num1>>num2;

num3 = gcd(num1, num2);

if(gcd)

cout<<\"GCD is \"<<num3<<endl;

else

cout<<\"invalid input\"<<endl\';

return 0;

}

int gcd(int a, int b)

{

return (b != 0) ? gcd(b, a%b) : a ;

}

 Section 1: Using the MARS or SPIM simulator develop a program that will evaluate the following expression 3 n n* (n 1) 15 where n is stored in a data location
 Section 1: Using the MARS or SPIM simulator develop a program that will evaluate the following expression 3 n n* (n 1) 15 where n is stored in a data location

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site