
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


Task

Write a function that takes two logical (boolean) values, and outputs the result of "and" and "or" on both arguments as well as "not" on the first arguments.

If the programming language doesn't provide a separate type for logical values, use the type most commonly used for that purpose.

If the language supports additional logical operations on booleans such as XOR, list them as well.




       IDENTIFICATION DIVISION.
       PROGRAM-ID. print-logic.
 
       DATA DIVISION.
       LOCAL-STORAGE SECTION.
       01  result                  PIC 1 USAGE BIT.
 
       LINKAGE SECTION.
       01  a                       PIC 1 USAGE BIT.
       01  b                       PIC 1 USAGE BIT.
 
       PROCEDURE DIVISION USING a, b.
           COMPUTE result = a B-AND b
           DISPLAY "a and b is " result
 
           COMPUTE result = a B-OR b
           DISPLAY "a or b is " result
 
           COMPUTE result = B-NOT a
           DISPLAY "Not a is " result
 
           COMPUTE result = a B-XOR b
           DISPLAY "a exclusive-or b is " result
 
           GOBACK
           .