Silkrooster News A place to share tidbits, neat features, and hopefully a tutorial or two

July 1, 2017


Filed under: — Silkrooster @ 12:12 am

Simple example using different languages to accomplish the same thing.

Multiplication Table Example

I am going to start by showing source code for multiple languages to create a multiplication table.  The point of this exercise, is to show the differences between various languages and how to do basic input/output, loops, variables, screen formatting.

This will be a Work In Progress, so I will be updating this post, to add additional languages and fix any minor glitches.

First we will look at C++ Just click the link below to navigate to that page to see the code.

Language C++ ; No runtime required

Language C++, .net v.4.0 runtime required.

Now we will look at C#. Since C# requires the .net runtime, there will be only one example.

Language C#, .net v.4.0 runtime required.

As you can see the C# and C++ CRL versions are extremely similar. This has to do with both using the .net library/class. The main difference you will see is how each language refers to its members. In C++ Two : are used where as in C# a single . is used. Also C# does not have to include any files, as it assumes you will be using the .net library/class.

Visual Basic also requires the .net runtime. However because of how the language was created, it does not require you to specify the runtime.

Visual Basic

The above languages require compiling. Whereas the following languages do not, so they are called scripting languages.

The first language JavaScript will be run in a web browser.

JavaScript (web browser)

Microsoft Powershell




for ($row = 1; $row -le 20; $row++) {

for ($col = 1; $col -le 12; $col++) {

$math = $col *$row;
Write-Host $math “`t “-NoNewline;

Write-Host “”;

Updated Power Shell Script

$out = “”;

for ($row = 1; $row -le 20; $row++) {

for ($col = 1; $col -le 12; $col++) {

$math = $col *$row;

if ($col -le 11) {

$out += $math.ToString() + “`t`t”;


else {
$out += $math.ToString() + “`n”;



Write-Output $out;

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress