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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started