How to resolve the algorithm Literals/Integer step by step in the Limbo programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Literals/Integer step by step in the Limbo programming language

Table of Contents

Problem Statement

Some programming languages have ways of expressing integer literals in bases other than the normal base ten.

Show how integer literals can be expressed in as many bases as your language allows.

Note:   this should not involve the calling of any functions/methods, but should be interpreted by the compiler or interpreter as an integer written to a given base. Also show any other ways of expressing literals, e.g. for different types of integers.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Literals/Integer step by step in the Limbo programming language

Source code in the limbo programming language

implement Command;

include "sys.m";
sys: Sys;

include "draw.m";

include "sh.m";

init(nil: ref Draw->Context, nil: list of string)
{
	sys = load Sys Sys->PATH;

	sys->print("%d\n", 2r1111); # binary
	sys->print("%d\n", 8r17);   # octal
	sys->print("%d\n", 15);     # decimal
	sys->print("%d\n", 16rF);   # hexadecimal
}


  

You may also check:How to resolve the algorithm Man or boy test step by step in the Haskell programming language
You may also check:How to resolve the algorithm Non-continuous subsequences step by step in the Scheme programming language
You may also check:How to resolve the algorithm Sum digits of an integer step by step in the ATS programming language
You may also check:How to resolve the algorithm Roman numerals/Encode step by step in the SETL programming language
You may also check:How to resolve the algorithm Euler's identity step by step in the Common Lisp programming language