Minimal Submied Files
You are required to turn in the following source file: assignment7.s
Objecves:
-write assembly language programs to:
-define a recursive procedure/function and call it.
-use syscall operations to display integers and strings on the console window
-use syscall operations to read integers from the keyboard. Assignment Description:
Implement a MIPS assembly language program that defines “main”, and “function1” procedures.
The function1 is recursive and should be defined as:
function1(n) = 5*n + 14 if n <= 3
= function1(n-1)/n + n*function1(n-3) + 4*n
otherwise
The main asks a user to enter an integer for n and calls the function1 by passing the n value, then prints the result. If your program causes an infinite loop, press Control and ‘C’ keys at the same time to stop it. Name your source code file assignment7.s.
C program that will ask a user to enter an integer, calls the fuction1, and prints the returned value from the function1.
// The function1 is a recursive procedure/function defined by: // function1(n) = 5*n + 14 if n <= 3 // = function1(n-1)/n + n*function1(n-3) + 4*n otherwise.
int function1(int n)
{
if (n <= 3) {
int ans1 = 5*n + 14;
return ans1;
}
else {
int ans1 = function1(n-1)/n + n*function1(n-3) + 4*n;
return ans1;
}
}
// The main calls function1 by entering an integer given by a user.
void main()
{
https://canvas.asu.edu/courses/56799/pages/assignment7-due-friday-september-25th-5pm?module_item_id=3410174 3/4
The following is a sample output (user input is in bold):
Enter an integer:
9
The solution is: 2207 ————————————————–
What to turn in:
-Upload your assignment7.s file through the assignment submission link in the course website by the assignment deadline. You must have your name, email address, program description, and other information in the header block as it was described in the assignment 1, and your programs should be well commented.
Go to “GradeScope” tab on Canvas -> CSE/EEE230 -> Assignment7, and upload your program file.
Each procedure/function needs to have a header using the following format:
############################################################ ################
# Procedure/Function function1
int ans, n;
printf("Enter an integer:\n");
// read an integer from user and store it in "n"
scanf("%d", &n);
ans = function1(n);
// print out the solution computed by function 1
printf("The solution is: %d\n", ans);
return; }
mb
9/23/2020 Assignment7 – Due: Friday, September 25th, 5pm: CSE 230: Computer Org/Assemb Lang Prog (2020 Fall)
# Description: —–
# parameters: $a0 = n value
# return value: $v0 = computed value
# registers to be used: $s3 and $s4 will be used. ############################################################ ################




