Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Dot-product/PureBasic/dot-product.basic
Normal file
24
Task/Dot-product/PureBasic/dot-product.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Procedure dotProduct(Array a(1),Array b(1))
|
||||
Protected i, sum, length = ArraySize(a())
|
||||
|
||||
If ArraySize(a()) = ArraySize(b())
|
||||
For i = 0 To length
|
||||
sum + a(i) * b(i)
|
||||
Next
|
||||
EndIf
|
||||
|
||||
ProcedureReturn sum
|
||||
EndProcedure
|
||||
|
||||
If OpenConsole()
|
||||
Dim a(2)
|
||||
Dim b(2)
|
||||
|
||||
a(0) = 1 : a(1) = 3 : a(2) = -5
|
||||
b(0) = 4 : b(1) = -2 : b(2) = -1
|
||||
|
||||
PrintN(Str(dotProduct(a(),b())))
|
||||
|
||||
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue