Jump to content

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 this post

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

_ArrayDisplay(\$aNumbers)oÝ÷ Ûú®¢×z·¢¶+"ÞÍ{e¢Sê.¶­\$²Ø^±©jÌ¨º»ºÚ"µÍÚ[ÛYH    Ð^K]LÉÝÂØØ[   ÌÍØS[XÖÌLVÌLNÓ][Z[ÂÜ   ÌÍÚHHHÈPÝ[
ÌÍØ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 this post

Share on other sites

Malkey

Yea! Nice solution! Thank you! muttley

Share this post

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 this post

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 this post

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 this post

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 this post

Share on other sites

Ok muttley should have known....

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

• Wiki

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.