How to resolve the algorithm Multiplication tables step by step in the N/t/roff programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Multiplication tables step by step in the N/t/roff 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 N/t/roff programming language

Source code in the n/t/roff programming language

.nf
.ta T 2mR
.nr x 1 1
.nr y 2 1
.nr p 0
.while (\n[x] <= 12) \{\
.if (\n[x]<10) \0\c
\n[x]\c
.if (\n[x]=1)           \c
.while (\n[y] <= 12) \{\
.nr p \n[x]*\n[y]
.ie (\n[y]>=\n[x])      \n[p]   \c
.el             \c
.nr y +1
.\}
.br
.nr x +1
.nr y 1 1
.\}


  

You may also check:How to resolve the algorithm Logical operations step by step in the Io programming language
You may also check:How to resolve the algorithm Detect division by zero step by step in the Oforth programming language
You may also check:How to resolve the algorithm Show the epoch step by step in the C# programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the Ring programming language
You may also check:How to resolve the algorithm CSV to HTML translation step by step in the J programming language