summaryrefslogtreecommitdiff
path: root/test/pending/shootout/harmonic.scala-3.scala
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2011-11-07 09:55:10 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2011-11-07 09:55:10 +0000
commitda929738ccfcf21cc3d8fdb9ce7734e59c6847f0 (patch)
tree90e335ca1fb60fde22ad345df72aeb0f08aace22 /test/pending/shootout/harmonic.scala-3.scala
parentc4e1b28cf79f73e4f8972263efb85ee879c39ebd (diff)
downloadscala-da929738ccfcf21cc3d8fdb9ce7734e59c6847f0.tar.gz
scala-da929738ccfcf21cc3d8fdb9ce7734e59c6847f0.tar.bz2
scala-da929738ccfcf21cc3d8fdb9ce7734e59c6847f0.zip
Backport of r25948
Diffstat (limited to 'test/pending/shootout/harmonic.scala-3.scala')
-rw-r--r--test/pending/shootout/harmonic.scala-3.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/pending/shootout/harmonic.scala-3.scala b/test/pending/shootout/harmonic.scala-3.scala
new file mode 100644
index 0000000000..28d031ae46
--- /dev/null
+++ b/test/pending/shootout/harmonic.scala-3.scala
@@ -0,0 +1,15 @@
+/* The Computer Language Shootout
+ http://shootout.alioth.debian.org/
+ contributed by Isaac Gouy (Scala novice)
+*/
+
+object harmonic {
+ def main(args: Array[String]) = {
+ val n = Integer.parseInt(args(0));
+ var partialSum = 0.0;
+ var i = 1;
+
+ while (i < n){ partialSum = partialSum + 1.0/i; i = i + 1; }
+ Console.printf("{0,number,#.000000000}\n")(partialSum);
+ }
+}