progs/lecture1.scala
changeset 361 f88b5cec2e5d
parent 360 e45d2890749d
child 364 f1a6fa599d26
equal deleted inserted replaced
360:e45d2890749d 361:f88b5cec2e5d
   481 test()
   481 test()
   482 
   482 
   483 
   483 
   484 
   484 
   485 
   485 
   486 ////////////
       
   487 // calculating pi 
       
   488 def f(n: BigInt) = BigDecimal(4 * n * n) / BigDecimal(4 * n * n - 1)
       
   489 
       
   490 2 * (BigInt(1) to BigInt(100000)).map(f).product
       
   491 
       
   492 (1 to 1000).sum
       
   493 (1 to 1000).product
       
   494 
       
   495 
       
   496 // Further Information
   486 // Further Information
   497 //=====================
   487 //=====================
   498 
   488 
   499 // The Scala homepage and general information is at
   489 // The Scala homepage and general information is at
   500 //
   490 //