How to resolve the algorithm Logical operations step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Logical operations step by step in the XPL0 programming language
Table of Contents
Problem Statement
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.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Logical operations step by step in the XPL0 programming language
Source code in the xpl0 programming language
include c:\cxpl\codes; \intrinsic 'code' declarations
func Logic(A, B);
int A, B;
[HexOut(0, A and B); ChOut(0, ^ );
HexOut(0, A or B); ChOut(0, ^ );
HexOut(0, not A); ChOut(0, ^ );
HexOut(0, A xor B);
]; \Logic
[Logic(false, false); CrLf(0);
Logic(true, false); CrLf(0);
Logic(true, true); CrLf(0);
Logic(1, 1); CrLf(0);
Logic(1, 2); CrLf(0);
]
You may also check:How to resolve the algorithm Trabb Pardo–Knuth algorithm step by step in the Julia programming language
You may also check:How to resolve the algorithm Snake step by step in the J programming language
You may also check:How to resolve the algorithm Archimedean spiral step by step in the Julia programming language
You may also check:How to resolve the algorithm Set, the card game step by step in the C++ programming language
You may also check:How to resolve the algorithm Draw a rotating cube step by step in the OxygenBasic programming language