How to resolve the algorithm Non-decimal radices/Output step by step in the Action! programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Non-decimal radices/Output step by step in the Action! programming language
Table of Contents
Problem Statement
Programming languages often have built-in routines to convert a non-negative integer for printing in different number bases. Such common number bases might include binary, Octal and Hexadecimal.
Print a small range of integers in some different bases, as supported by standard routines of your programming language.
This is distinct from Number base conversion as a user-defined conversion function is not asked for.) The reverse operation is Common number base parsing.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Non-decimal radices/Output step by step in the Action! programming language
Source code in the action! programming language
INCLUDE "D2:PRINTF.ACT" ;from the Action! Tool Kit
PROC Main()
CARD ARRAY v=[6502 1977 2021 256 1024 12345 9876 1111 0 16]
BYTE i,LMARGIN=$52,old
old=LMARGIN
LMARGIN=0 ;remove left margin on the screen
Put(125) PutE() ;clear the screen
FOR i=0 TO 9
DO
PrintF("(dec) %D = (hex) %H = (oct) %O%E",v(i),v(i),v(i))
OD
LMARGIN=old ;restore left margin on the screen
RETURN
You may also check:How to resolve the algorithm Loops/Downward for step by step in the Java programming language
You may also check:How to resolve the algorithm Self-describing numbers step by step in the Erlang programming language
You may also check:How to resolve the algorithm Hamming numbers step by step in the RPL programming language
You may also check:How to resolve the algorithm Long multiplication step by step in the Run BASIC programming language
You may also check:How to resolve the algorithm Enforced immutability step by step in the Ada programming language