Question: Write a MIPS program that: Takes as input from the user an integer between 1 and 46. Integers less than 1 or greater than 46

Write a MIPS program that:

Takes as input from the user an integer between 1 and 46. Integers less than 1 or greater than 46 should be rejected, and the user should be prompted for another number.

Fills the array with each number in the Fibonacci sequence, up to the number called for in the user input. So, if the user inputs 10, the program should calculate the first ten numbers in the Fibonacci sequence, along with the zero-th term.

Print each number in the array to the screen.

In C++ code: int userInput; //Input received from the user

int fib[47];

fib[0] = 0;

fib[1] = 1;

for(int i = 2; i <= userInput; i++)

{

fib[i] = fib[i-1] + fib[i-2];

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!