Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 4: Subroutine call and return Using two important instructions of MARIE (JnS and JumpI), implement a subroutine (a function) such that when this function

image text in transcribedimage text in transcribed

Part 4: Subroutine call and return Using two important instructions of MARIE (JnS and JumpI), implement a subroutine (a function) such that when this function is called, it will calculate, print and save the next element in a Fibonacci series. As you know, Fibonacci numbers can be calculated based on the following equations i-1 Formulas for Fibonacci series In this Part, you should implement a subroutine and a program that calls that subroutine Assume your subroutine is called FIBO, such that when FIBO is called it will first calculate the next element in Fibonacci series, then it will print and save the calculated Fibonacci number in an array in MARIE memory. At the beginning, the first two elements in your array will be one (1) and all other elements will be zero, and then at the end of the program your array will have 16 elements of Fibonacci series including those two initial values of 1. (Hint: you can implement the following Pseudo code that will call your FIBO subroutine You also should implement FIBO subroutine to calculate next Fibonacci number.) Fl:-l; / Fl: Starting element 1 F2:-1; // F2: Starting element 2 FOR X:1 to 10 DO FIBO Call which Calculates, prints and then save the next FIBONACCI number in your array) (this part calls your FIBO subroutine, ENDFOR If F1-1 and F2-1, at the end of your program, array (A) will look like as follows: Part 4: Subroutine call and return Using two important instructions of MARIE (JnS and JumpI), implement a subroutine (a function) such that when this function is called, it will calculate, print and save the next element in a Fibonacci series. As you know, Fibonacci numbers can be calculated based on the following equations i-1 Formulas for Fibonacci series In this Part, you should implement a subroutine and a program that calls that subroutine Assume your subroutine is called FIBO, such that when FIBO is called it will first calculate the next element in Fibonacci series, then it will print and save the calculated Fibonacci number in an array in MARIE memory. At the beginning, the first two elements in your array will be one (1) and all other elements will be zero, and then at the end of the program your array will have 16 elements of Fibonacci series including those two initial values of 1. (Hint: you can implement the following Pseudo code that will call your FIBO subroutine You also should implement FIBO subroutine to calculate next Fibonacci number.) Fl:-l; / Fl: Starting element 1 F2:-1; // F2: Starting element 2 FOR X:1 to 10 DO FIBO Call which Calculates, prints and then save the next FIBONACCI number in your array) (this part calls your FIBO subroutine, ENDFOR If F1-1 and F2-1, at the end of your program, array (A) will look like as follows

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

Discuss why human resources managers need to understand strategy.

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago