Little Man Computer

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

badboy123

Thread Starter
Joined
Nov 11, 2011
Messages
3
Hi, i need a LMC program written that outputs the smallest of three numbers?


Thanks.
 

Ent

Josiah
Retired Trusted Advisor
Joined
Apr 11, 2009
Messages
5,467
I'm sorry, but we don't generally do people's homework for them. If you can show that you're working on some code but have a specific problem, you might get some help but still have to do the work yourself. Otherwise how would you learn?
 
Joined
May 20, 2010
Messages
4,040
Ent is correct. What you are asking is a simple thing, a simple math. That's all. Apart from that, some Programming languages has methods to do this for you too..
 

badboy123

Thread Starter
Joined
Nov 11, 2011
Messages
3
This is what ive done so far:

My flowchart is summat like this:

Input A, B, C ---> is A<B ----> If yes, ----> is A<C -------> if Yes, output A, if no output C
Input A, B, C ----> is A<B ----> If No -----> is B<C -------> If yes, output B, if no output C



MB Op-Code Description
00 901 Input A
01 397 Store A in MB 97
02 901 Input B
03 398 Store B in MB 98
04 297 Subtract A from B
05 808 If positive, go to MB 08
06 598 Load MB 98 (B)
07 616 Send to MB 16
08 597 Load MB 97 (A)
09 901 Input C
10 399 Store C in MB 99
11 297 Subtract A from C
12 821 If positive, go to MB 21
13 599 Load MB 99
14 902 Output MB 99 (C)
15 000 HALT
16 901 Input the data received from MB 07 (B)
17 398 Store B in MB 98
18 299 Subtract B from C
19 821 If positive, go to MB 21
20 599 Load MB 99 (C)
21 902 Output
22 000 HALT
23 598 Load MB 98
24 902 Output
25 000 HALT
97 000 DATA
98 000 DATA
99 000 DATA

I think its ok but not sure
 

Ent

Josiah
Retired Trusted Advisor
Joined
Apr 11, 2009
Messages
5,467
So what goes wrong when you try to run this?
 

badboy123

Thread Starter
Joined
Nov 11, 2011
Messages
3
I havent tried running this. I just wanted to know whether it was correct, as i am new to this and this is only a sample question. Its not the actual exam question.
 

Ent

Josiah
Retired Trusted Advisor
Joined
Apr 11, 2009
Messages
5,467
In that case I suggest you just run it and see what it makes of a few combinations of values. LMC is designed to give you a run through of what your computer is doing, it can explain things much better than we can.

Remember when testing to give it values that it should find easy and values that might confuse it (e.g. how does it handle the two numbers being equal?)
 

Cookiegal

Karen
Administrator
Malware Specialist Coordinator
Joined
Aug 27, 2003
Messages
120,156
I'll close this now since we don't assist with homework.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top