Question: 1) Write a program that asks user How many positive numbers that are divisible by 6 do you want to add?. Your loop counter would
1) Write a program that asks user How many positive numbers that are divisible by 6 do you want to add?. Your loop counter would be the user input. If the user enters a positive number between 1 and 100 that is divisible by 6, you increment your loop counter and add it to the sum. You need to decide if the positive number entered by the user is divisible by 6 or not. Your program should print an error message if the number is not within the range and ask user for another number An Example of sample input and output would be:
==============================================
How many positive number that is devisable by you want to add? 3
Enter a number: 36 ==>
36 is divisible by 6
Enter a number: -20 ==>
**** ERROR: -20 is not a positive number. Enter another number.
Enter a number: 0 ==>
**** ERROR: 0 is not in the range of 1 to 100. Enter another number.
Enter a number: 21 ==>
21 is not divisible by 6. Enter another number.
Enter a number: 121 ==>
**** ERROR: 121 is not in the range of 1 to 100. Enter another number.
Enter a number: 6 ==> 6 is divisible by 6
Enter a number: 12 ==> 12 is divisible by 6
The Sum of the positive numbers between 1 and 100 that are devisable by 6, is: 54
=============================================
This is supposed to be done using the MARS simulator for the MIPS Processor.
using code such as beq, syscall, add $s0, $v0, $0 and other code that looks similar to this.
Please keep the answer as simple as possible. Comments are incredibly appreciated.
Please try to use "add" instead of move, and if a remainder is required, use mfhi/mflo to solve.
If there are any questions or requests to change my question please comment and I will try to update it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
