Anonymous user
Sum and product of an array: Difference between revisions
→{{header|Groovy}}
(Logo) |
|||
Line 245:
' + 0 a 5 reduce . \ 15
' * 1 a 5 reduce . \ 120
=={{header|Fortran}}==
In ISO Fortran 90 and later, use SUM intrinsic:
REAL, DIMENSION(1000) :: A = (/ (1.0/(i*i), i=1, 1000) /)
REAL :: RESULT
RESULT = SUM(A);
=={{header|Groovy}}==
|