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

Published on 12 May 2024 09:40 PM

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

Source code in the ada programming language

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Fixed;  use Ada.Strings.Fixed;
procedure Multiplication_Table is
   package IO is new Integer_IO (Integer);
   use IO;
begin
   Put ("  | ");
   for Row in 1..12 loop
      Put (Row, Width => 4);
   end loop;
   New_Line;
   Put_Line ("--+-" & 12 * 4 * '-');
   for Row in 1..12 loop
      Put (Row, Width => 2);
      Put ("| ");
      for Column in 1..12 loop
         if Column < Row then
            Put ("    ");
         else
            Put (Row * Column, Width => 4);
         end if;
      end loop;
      New_Line;
   end loop;
end Multiplication_Table;


  

You may also check:How to resolve the algorithm Chaos game step by step in the Run BASIC programming language
You may also check:How to resolve the algorithm Longest string challenge step by step in the Python programming language
You may also check:How to resolve the algorithm Towers of Hanoi step by step in the BQN programming language
You may also check:How to resolve the algorithm Galton box animation step by step in the Yabasic programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Pixilang programming language