How to resolve the algorithm Multiplication tables step by step in the DCL programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Multiplication tables step by step in the DCL programming language

Table of Contents

Problem Statement

Produce a formatted   12×12   multiplication table of the kind memorized by rote when in primary (or elementary) school.

Only print the top half triangle of products.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Multiplication tables step by step in the DCL programming language

Source code in the dcl programming language

$ max = 12
$ h = f$fao( "!4* " )
$ r = 0
$ loop1:
$  o = ""
$  c = 0
$  loop2:
$   if r .eq. 0 then $ h = h + f$fao( "!4SL", c )
$   p = r * c
$   if c .ge. r
$   then
$    o = o + f$fao( "!4SL", p )
$   else
$    o = o + f$fao( "!4* " )
$   endif
$   c = c + 1
$   if c .le. max then $ goto loop2
$  if r .eq. 0
$  then
$   write sys$output h
$   n = 4 * ( max + 2 )
$   write sys$output f$fao( "!''n*-" )
$  endif
$  write sys$output f$fao( "!4SL", r ) + o
$  r = r + 1
$  if r .le. max then $ goto loop1

  

You may also check:How to resolve the algorithm Langton's ant step by step in the Befunge programming language
You may also check:How to resolve the algorithm Greatest subsequential sum step by step in the Nim programming language
You may also check:How to resolve the algorithm Mandelbrot set step by step in the IDL programming language
You may also check:How to resolve the algorithm Palindrome detection step by step in the Emacs Lisp programming language
You may also check:How to resolve the algorithm Identity matrix step by step in the EasyLang programming language