Trabb Pardo–Knuth algorithm: Difference between revisions
Content added Content deleted
m (→{{header|Modula-2}}: Standard ABS function used.) |
imported>Arakov |
||
Line 1,696: | Line 1,696: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
{{trans|C}} |
{{trans|C}} |
||
ELENA |
ELENA 6.x : |
||
<syntaxhighlight lang="elena">import extensions; |
<syntaxhighlight lang="elena">import extensions; |
||
import extensions'math; |
import extensions'math; |
||
Line 1,704: | Line 1,704: | ||
real[] inputs := new real[](11); |
real[] inputs := new real[](11); |
||
console.printLine("Please enter 11 numbers :"); |
console.printLine("Please enter 11 numbers :"); |
||
for(int i := 0 |
for(int i := 0; i < 11; i += 1) |
||
{ |
{ |
||
inputs[i] := console.readLine().toReal() |
inputs[i] := console.readLine().toReal() |
||
Line 1,710: | Line 1,710: | ||
console.printLine("Evaluating f(x) = |x|^0.5 + 5x^3 for the given inputs :"); |
console.printLine("Evaluating f(x) = |x|^0.5 + 5x^3 for the given inputs :"); |
||
for(int i := 10 |
for(int i := 10; i >= 0; i -= 1) |
||
{ |
{ |
||
real result := sqrt(abs(inputs[i])) + 5 * power(inputs[i], 3); |
real result := sqrt(abs(inputs[i])) + 5 * power(inputs[i], 3); |