diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2011-11-02 14:34:35 +0000 |
commit | b6778be91900b8161e705dc2598ef7af86842b0b (patch) | |
tree | d15e8ec18a37eec212f50f1ace27714d7e7d4d34 /test/pending/shootout/harmonic.scala-2.scala.runner | |
parent | ac6c76f26d884a94d0c9ff54f055d3f9ab750bac (diff) | |
download | scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.gz scala-b6778be91900b8161e705dc2598ef7af86842b0b.tar.bz2 scala-b6778be91900b8161e705dc2598ef7af86842b0b.zip |
Begone t1737...
Diffstat (limited to 'test/pending/shootout/harmonic.scala-2.scala.runner')
-rw-r--r-- | test/pending/shootout/harmonic.scala-2.scala.runner | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/pending/shootout/harmonic.scala-2.scala.runner b/test/pending/shootout/harmonic.scala-2.scala.runner new file mode 100644 index 0000000000..d0ea85742a --- /dev/null +++ b/test/pending/shootout/harmonic.scala-2.scala.runner @@ -0,0 +1,16 @@ +/* The Computer Language Shootout + http://shootout.alioth.debian.org/ + contributed by Isaac Gouy (Scala novice) +*/ +object Test extends Application { + for(n <- List(6000000,8000000,10000000)) harmonic.main(Array(n.toString)) +} +object harmonic { + def main(args: Array[String]) = { + val n = Integer.parseInt(args(0)); + var partialSum = 0.0; + + for (i <- Iterator.range(1,n+1)) partialSum = partialSum + 1.0/i; + Console.printf("{0,number,#.000000000}\n")(partialSum); + } +} |