summaryrefslogtreecommitdiff
path: root/test/pending/shootout/harmonic.scala-2.scala.runner
blob: d0ea85742a1ea7b4971edfdb6845ce8681d57ba7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
   }
}