Questions tagged [little-man-computer]

Little Man Computer (LMC) models an instructional Von Neumann computer architecture and uses assembly language.

Little Man Computer (LMC) models an instructional Von Neumann computer architecture and uses language. It is mostly used for educational purposes.

Questions about programming issues involving LMC should clarify which simulator the code should run on, as there are different interpretations on how a LMC should work with negative numbers and overflow.

There are several simulators available on the web, including those published by:

These take assembly code as input and run the program visualising the process.

For more info, see:

90 questions
0
votes
1 answer

How to print a list of values + max/min

I am looking at this Little man computer problem: The user will enter first the size of the data, and then the individual numbers. I have to print (OUT) excatcly what was input, followed by the max and the min of the data values Example: First…
code99
  • 13
  • 2
0
votes
2 answers

Output a sequence

For a Little Man Computer (LMC) simulator I have the following assignment: Your code must accept a number between 1 and 15. It must then add the number 2 (to the submitted number), before displaying the new total. This process must be repeated…
trombonee
  • 31
  • 7
0
votes
2 answers

Bubble sort with variable number of inputs

I am working on a bubble sort program for the Little Man Computer and I want it to have a variable number of inputs (like 500), after which the program will stop taking inputs and will sort the values from least to greatest. Note that zero should be…
Anyonomiss
  • 25
  • 5
0
votes
1 answer

e-LMC extended Little Man Computer bubble embedded program continuous input

I am looking for a e-LMC extended little man computer program that will accept an indefinite inputs and bubble-sort them. I need to have more inputs continuous and then do the bubble sort. INP //read 1st value STA 0 // for store INP // read 2nd…
0
votes
1 answer

Branching when negative accumulator

I'm trying to create a loop that will print if a number given is odd or even (Par). How do I branch the loop when the accumulator value is -1? START INP // int(input("")) STA n // n = LOOP LDA n // BRZ END // while n !=0: …
0
votes
1 answer

Program to sum input numbers is not working

I am trying to make a program that first takes n inputs from the user, and then calculates the sum of those numbers. Then I want the program to print if the sum is an even or an odd number. For example if the user types in 3, he/she will have to…
heheh
  • 11
  • 2
0
votes
1 answer

How to find the greatest of more than two input numbers

I was able to write an LMC program which finds the greater value of two input values. But how do I modify it to find the greatest value of any number of input values, not only two? Below is my code: START INP STA NUM1 INP …
0
votes
1 answer

Bubble sort 4 numbers

I'm trying to code a bubble sort using the LMC, and well, it's not going too great. First of all it just loops for all eternity, and I cannot figure out the cause, maybe a pair of fresh eyes would help? I am unsure if I need to add a "sort 4"…
0
votes
2 answers

How to take number up to 64 and output in a 000 000 binary format

The goal is to accept a number up to 64 and output it in binary in a 000 000 format, so encoded in two decimal values. I know that LMC wont allow an output number like 010, so a format like 11 100 is also acceptable. Here is my code so far: …
user14211371
0
votes
1 answer

How to loop and encode as binary?

I am trying to get a program running in the LMC that converts any numerical to binary. Normally I would just use the divide method, but I cannot do that since the Little Man Computer does not allow for divide or multiplication. The farthest I've…
user14211371
0
votes
2 answers

Summing up values if number of values is given as first input

How do I write a Little Man program that adds up a series of input numbers and outputs the sum. The first input value will contain the number of values that follow as input, and which are to be added together. I know this can be done by using for…
Infinity_hunter
  • 157
  • 1
  • 7
0
votes
1 answer

How to find the sum of odd numbers in LMC

I am learning LMC, but I am not able to find the sum of odd numbers till 100 in LMC such as 1+3+5+7... and so on I did write the code to add the two numbers INP //here I wil input 1 STA 99 INP // here I will input 2 ADD 99 OUT HLT I am…
Hemlata
  • 65
  • 1
  • 8
0
votes
1 answer

Little Man Computer Integer Division with Remainder

I've managed to code an LMC program which works on this simulator for performing integer division. However if there is a remainder it goes into an infinite loop. I'm trying to think of a way to just keep the quotient regardless of whether there is a…
Robin Andrews
  • 3,514
  • 11
  • 43
  • 111
0
votes
0 answers

How to do a base conversion with Little Man Computer?

I need to convert a decimal number to a base between 2 and 9 using Little Man Computer. How do I proceed? I believe successive divisions are the best method. In my opinion, I must write a code which divides two numbers, then save the integer ratio…
QCyrax
  • 9
  • 1
0
votes
0 answers

how to convert a number from base 10 to any other base using Little Man Computer

I need to create a program that takes as the first input : A decimal number and as a second input the number of the base it will be converted to . then outputs the result of the conversion . I looked everywhere on the internet but i cant seem…
soso xoxo
  • 1
  • 4