English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Write a machine language program that will get two numbers from the user. If these two values are not equal, the program should output the second number. Otherwise, there should be no output. Use the following algorithm.
Statement Operation Algorithm
1. Get first number
2. Get second number
3. If (first number <> second number) then
4. Display the second number
5. Stop

Please help me.

2007-04-03 12:05:52 · 3 answers · asked by Facilitate 1 in Computers & Internet Programming & Design

3 answers

You will need to give a LOT more information for anyone to help you with this question...

Machine language is 1's and 0's for your commands and are totally dependent upon the machine you are using...

You should first plan the EXACT steps that your computer will need to take in order to do the required steps...

1. Get first number: 1a. You will need to read the keyboard or other input device to see if a number has been entered, you may need to translate it from some keyboard code into a true number.. you many even need to clear some flags, check a register for input, and do it over and over until you get an input.. and THEN you will need to check to see if it is the last digit of the number (say at the end of a number string)

2. Get second number: 2a. Basically the same as the first number so you will be able to use some of your code over only using different addresses for storing the number...

3. subtract the second number from the first, compare the answer to zero (stored someplace beforehand) and if it is equal to zero then transfer the second number's digits out to a display...

Not knowing what processor you are using or the instruction set for your computer and the register usage makes machine language programming very hard.. or impossible.

2007-04-03 12:27:33 · answer #1 · answered by ♥Tom♥ 6 · 0 0

I'd like to help, but I'm not sure if you actually want machine language...

http://www.webopedia.com/TERM/m/machine_language.html

2007-04-03 19:16:26 · answer #2 · answered by ? 4 · 0 0

You must mean ASSEMBLY language.

And you need to specify what CPU, or this is going nowhere.

2007-04-03 19:26:46 · answer #3 · answered by Kasey C 7 · 0 0

fedest.com, questions and answers