How to resolve the algorithm Show ASCII table step by step in the Prolog programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Show ASCII table step by step in the Prolog programming language
Table of Contents
Problem Statement
Show the ASCII character set from values 32 to 127 (decimal) in a table format.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Show ASCII table step by step in the Prolog programming language
Source code in the prolog programming language
ascii :-
forall(between(32, 47, N), row(N)).
row(N) :- N > 127, nl, !.
row(N) :-
code(N),
ascii(N),
Nn is N + 16,
row(Nn).
code(N) :- N < 100, format(' ~d : ', N).
code(N) :- N >= 100, format(' ~d : ', N).
ascii(32) :- write(' Spc '), !.
ascii(127) :- write(' Del '), !.
ascii(A) :- char_code(D,A), format(' ~w ', D).
You may also check:How to resolve the algorithm Unicode variable names step by step in the 8th programming language
You may also check:How to resolve the algorithm Magic squares of odd order step by step in the C programming language
You may also check:How to resolve the algorithm Holidays related to Easter step by step in the Quackery programming language
You may also check:How to resolve the algorithm Search a list step by step in the S-lang programming language
You may also check:How to resolve the algorithm Determine if a string has all the same characters step by step in the BCPL programming language