PA1: Write a MARIE assembly language program to compute D = (A+B) - (C-B) + (A-C). Please download and use the skeleton code (expr_skeleton.mas). |
PA2: Write a MARIE assembly language program to add all positive values in an array and display the sum. Please download and use the skeleton code (array_skeleton.mas). |
PA3: Write a MARIE program to compute factorial using a loop. As the MARIE architecture does not have multiplication instruction, a subroutine Mult that multiplies two non-negative integers is given in a skeleton code which can be downloaded here (fac_loop_subr_skeleton.mas). |
Note that factorial of N can be defined as below.
The following C++ program computes factorial using a loop for your reference.
int main(){ int N, C; cout << "Please enter an integer:" << endl; cin >> N; if (N == 0) return 1; else { C = 1; for (int i = 1; i
<= N; i++) C =
C*i; } cout << C << endl; // Print result return 0; } |
Please
submit your MARIE source codes in Canvas by the due day.