Multiplication tables: Difference between revisions
Content added Content deleted
Antoni Gual (talk | contribs) |
|||
Line 7,207: | Line 7,207: | ||
</pre> |
</pre> |
||
=={{header|VBScript}}== |
|||
<syntaxhighlight lang="vb"> |
|||
function pad(s,n) if n<0 then pad= right(space(-n) & s ,-n) else pad= left(s& space(n),n) end if |
|||
End Function |
|||
Sub print(s): |
|||
On Error Resume Next |
|||
WScript.stdout.Write (s) |
|||
If err= &h80070006& Then WScript.Echo " Please run this script with CScript": WScript.quit |
|||
End Sub |
|||
For i=1 To 12 |
|||
print pad(i,-4) |
|||
Next |
|||
print vbCrLf & String(48,"_") |
|||
For i=1 To 12 |
|||
print vbCrLf |
|||
For j=1 To 12 |
|||
if j<i Then print Space(4) Else print pad(i*j,-4) |
|||
Next |
|||
print "|"& pad(i,-2) |
|||
Next |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<small> |
|||
<pre> |
|||
1 2 3 4 5 6 7 8 9 10 11 12 |
|||
________________________________________________ |
|||
1 2 3 4 5 6 7 8 9 10 11 12| 1 |
|||
4 6 8 10 12 14 16 18 20 22 24| 2 |
|||
9 12 15 18 21 24 27 30 33 36| 3 |
|||
16 20 24 28 32 36 40 44 48| 4 |
|||
25 30 35 40 45 50 55 60| 5 |
|||
36 42 48 54 60 66 72| 6 |
|||
49 56 63 70 77 84| 7 |
|||
64 72 80 88 96| 8 |
|||
81 90 99 108| 9 |
|||
100 110 120|10 |
|||
121 132|11 |
|||
144|12 |
|||
</pre> |
|||
</small> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
{{libheader|Wren-fmt}} |
{{libheader|Wren-fmt}} |
||
Line 7,236: | Line 7,276: | ||
12 | 144 |
12 | 144 |
||
</pre> |
</pre> |
||
=={{header|XPL0}}== |
=={{header|XPL0}}== |