How to resolve the algorithm Count in octal step by step in the MiniScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Count in octal step by step in the MiniScript programming language

Table of Contents

Problem Statement

Produce a sequential count in octal,   starting at zero,   and using an increment of a one for each consecutive number. Each number should appear on a single line,   and the program should count until terminated,   or until the maximum value of the numeric type in use is reached.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Count in octal step by step in the MiniScript programming language

Source code in the miniscript programming language

toOctal = function(n)
	result = ""
	while n != 0
		octet = n % 8
		n = floor(n / 8)
		result = octet + result
	end while
	return result
end function

maxnum = 10 ^ 15 - 1
i = 0
while i < maxnum
	i += 1
	print i + " = " + toOctal(i)
end while


  

You may also check:How to resolve the algorithm Super-d numbers step by step in the Ruby programming language
You may also check:How to resolve the algorithm Mad Libs step by step in the REXX programming language
You may also check:How to resolve the algorithm Iterated digits squaring step by step in the ALGOL 68 programming language
You may also check:How to resolve the algorithm FizzBuzz step by step in the Go programming language
You may also check:How to resolve the algorithm Rosetta Code/Count examples step by step in the J programming language