# Pythagorean table

## Recommended Posts

Ok, just from curiosity, there is any (easy) way to creating the Pythagor table? My solution muttley

```#include <Array.au3>

Global \$aNumbers[10][10]

;Array filling
For \$i = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i
Next

;Multiplying
For \$i = 1 To UBound(\$aNumbers) - 1
For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][\$j] = \$aNumbers[\$i][0] * \$aNumbers[0][\$j]
Next
Next

_ArrayDisplay(\$aNumbers)```

##### Share on other sites

Ok, just from curiosity, there is any (easy) way to creating the Pythagor table? My solution muttley

```#include <Array.au3>

Global \$aNumbers[10][10]

;Array filling
For \$i = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i
Next

;Multiplying
For \$i = 1 To UBound(\$aNumbers) - 1
For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][\$j] = \$aNumbers[\$i][0] * \$aNumbers[0][\$j]
Next
Next

ÌÍØS[XÊHHBÜ    ÌÍÚHHÈPÝ[
ÌÍØS[XÊHHBBIÌÍØS[XÖÉÌÍÚWVÌHH   ÌÍÚBBIÌÍØS[XÖÌVÉÌÍÚHH   ÌÍÚ  ÌÍØS[XÖÉÌÍÚWVÉÌÍÚHH ÌÍÚJÌÍÚBB^^Ð^QÜ^J   ÌÍØS[XÊ```

##### Share on other sites

Malkey

Yea! Nice solution! Thank you! muttley

##### Share on other sites

Corrected:

```#include <Array.au3>

Local \$aNumbers[10][10];Multiplying

For \$i = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i

For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][\$j] = \$i * \$j
Next
Next

_ArrayDisplay(\$aNumbers)```

##### Share on other sites

Corrected:

```#include <Array.au3>

Local \$aNumbers[10][10];Multiplying

For \$i = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i

For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][\$j] = \$i * \$j
Next
Next

_ArrayDisplay(\$aNumbers)```
Could have kept as:

```#include <Array.au3>

Local \$aNumbers[10][10];Multiplying
For \$i = 1 To UBound(\$aNumbers) - 1
For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i
\$aNumbers[\$i][\$j] = \$i*\$j
Next
Next

_ArrayDisplay(\$aNumbers)```

Either all, it works the same muttley

##### Share on other sites

Could have kept as:

```#include <Array.au3>

Local \$aNumbers[10][10];Multiplying
For \$i = 1 To UBound(\$aNumbers) - 1
For \$j = 1 To UBound(\$aNumbers) - 1
\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i
\$aNumbers[\$i][\$j] = \$i*\$j
Next
Next

_ArrayDisplay(\$aNumbers)```

Either all, it works the same muttley

The output might be the same... but it certainly does Not work the same.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

Bert

As say SmOke_N your example not work the same, also your example do slowed work. Why need to set same value into this array 9 time

```\$aNumbers[\$i][0] = \$i
\$aNumbers[0][\$i] = \$i```

muttley

##### Share on other sites

Ok muttley should have known....

## Create an account

Register a new account

×

• Wiki

• Back

• Git