
Basic Data Operation

This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:


Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |
Comparison |
Matching
Memory Operations
Pointers & references |
Addresses


Get two integers from the user.

Then,   display a message if the first integer is:

   less than, 
   equal to,   or 
   greater than
the second integer.



Test the condition   for each case separately,   so that   all three comparison operators are used   in the code.



Related task

   String comparison


[ Integer comparison
  ==================
 
  A program for the EDSAC
 
  Illustrates the use of the E
  (branch on accumulator sign
  bit clear) and G (branch on
  accumulator sign bit set)
  orders
 
  The integers to be tested, x
  and y, should be stored in
  addresses 13@ and 14@
 
  Output: the program causes the
  machine to print
    '+' if x > y,
    '=' if x = y,
    '-' if x < y.
 
  Works with Initial Orders 2   ]
 
        T56K  [ load point      ]
        GK    [ base address    ]
 
        O15@  [ figure shift    ]
 
        A13@  [ a = x           ]
        S14@  [ a -= y          ]
        G10@  [ if a<0 go to 10 ]
 
        S12@  [ a -= 1          ]
        E8@   [ if a>=0 go to 8 ]
 
        O17@  [ write '='       ]
        ZF    [ halt            ]
 
[  8 ]  O16@  [ write '+'       ]
        ZF    [ halt            ]
 
[ 10 ]  O18@  [ write '-'       ]
        ZF    [ halt            ]
 
[ 12 ]  P0D   [ const: 1        ]
 
[ 13 ]  P16D  [ x = 37          ]
[ 14 ]  P14F  [ y = 28          ]
 
[ 15 ]  #F    [ figure shift    ]
[ 16 ]  ZF    [ + character     ]
[ 17 ]  VF    [ = character     ]
[ 18 ]  AF    [ - character     ]
 
        EZPF  [ begin execution ]