Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Forward-difference/NetRexx/forward-difference.netrexx
Normal file
34
Task/Forward-difference/NetRexx/forward-difference.netrexx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* NetRexx*************************************************************
|
||||
* Forward differences
|
||||
* 18.08.2012 Walter Pachl derived from Rexx
|
||||
**********************************************************************/
|
||||
Loop n=-1 To 11
|
||||
differences('90 47 58 29 22 32 55 5 55 73',n)
|
||||
End
|
||||
|
||||
method differences(a,n) public static
|
||||
--arr=Rexx[11] -- array must be declared (zero based)
|
||||
arr='' -- alternative: indexed string
|
||||
m=a.words
|
||||
Select
|
||||
When n<0 Then Say 'n is negative:' n '<' 0
|
||||
When n>m Then Say 'n is too large:' n '>' m
|
||||
Otherwise Do
|
||||
Loop i=1 To m
|
||||
arr[i]=a.word(i)
|
||||
End
|
||||
Loop i = 1 to n
|
||||
t = arr[i]
|
||||
Loop j = i+1 to m
|
||||
u = arr[j]
|
||||
arr[j] = arr[j]-t
|
||||
t = u
|
||||
end
|
||||
end
|
||||
ol=''
|
||||
Loop i=n+1 to m
|
||||
ol=ol arr[i]
|
||||
End
|
||||
Say n ol
|
||||
End
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue