Jump to content

Vector: Difference between revisions

Added Easylang
m (→‎{{header|Wren}}: Changed to Wren S/H)
(Added Easylang)
Line 704:
(55,0 + i77,0)
(2,5 + i3,5)
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
proc vadd a[] b[] . r[] .
r[] = [ ]
for i to len a[]
r[] &= a[i] + b[i]
.
.
proc vsub a[] b[] . r[] .
r[] = [ ]
for i to len a[]
r[] &= a[i] - b[i]
.
.
proc vmul a[] b . r[] .
r[] = [ ]
for i to len a[]
r[] &= a[i] * b
.
.
proc vdiv a[] b . r[] .
r[] = [ ]
for i to len a[]
r[] &= a[i] / b
.
.
vadd [ 5 7 ] [ 2 3 ] r[]
print r[]
vsub [ 5 7 ] [ 2 3 ] r[]
print r[]
vmul [ 5 7 ] 11 r[]
print r[]
vdiv [ 5 7 ] 2 r[]
print r[]
</syntaxhighlight>
 
{{out}}
<pre>
[ 7 10 ]
[ 3 4 ]
[ 55 77 ]
[ 2.50 3.50 ]
</pre>
 
2,083

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.