How can the MARIE processor be used to count the number of zeroes in user input?

In summary, The conversation discusses writing a MARIE program that counts the number of occurrences of '0' in a sequence of decimal digits. The program should also stop counting when a non-digit is received. The user suggests starting with reading user input and using the SKIPCOND instruction to check for zeroes.
  • #1
twoski
181
2

Homework Statement



Write a MARIE program that repeatedly receives a sequence of decimal digits (one digit at a time) and counts the number of occurrences of ‘0’ and stores it in memory location Count until a non-digit is received. Assemble and run your program using the MARIE simulator

Homework Equations



http://www.edwardbosworth.com/CPSC2105/Lectures/Slides_05/Chapter_04/MARIE_Organization.htm

The Attempt at a Solution



I start with reading user input, but how do i check how many zeroes are in the input if i can only add/subtract values?
 
Physics news on Phys.org
  • #2
twoski said:
I start with reading user input, but how do i check how many zeroes are in the input if i can only add/subtract values?
The MARIE processor also has a SKIPCOND instruction, how could you make use of that?
 

What is "MARIE: Count 0s in User Input"?

"MARIE: Count 0s in User Input" is a program that uses the MARIE (Machine Architecture that is Really Intuitive and Easy) assembly language to count the number of 0s in a user inputted number.

How does "MARIE: Count 0s in User Input" work?

This program uses a loop to check each digit in the user inputted number and counts the number of 0s it encounters. It then displays the total count of 0s at the end.

What is the purpose of "MARIE: Count 0s in User Input"?

The purpose of this program is to demonstrate the use of loops and conditional statements in the MARIE assembly language. It also helps users understand how to manipulate and count numbers in a computer program.

What is the input and output of "MARIE: Count 0s in User Input"?

The input for this program is a number entered by the user. The output is the total count of 0s in the inputted number.

What is the significance of the name "MARIE" in this program?

The name "MARIE" stands for Machine Architecture that is Really Intuitive and Easy. It is a simplified assembly language designed for educational purposes to help students understand computer architecture and programming concepts.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
22
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
11
Views
5K
  • Programming and Computer Science
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
9K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
Back
Top