Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mdad:laboratoare:01 [2020/10/19 11:50]
alexandru.radovici
mdad:laboratoare:01 [2020/10/19 14:47] (current)
ioana_maria.culic [Tasks]
Line 16: Line 16:
   - Write a Kotlin function that computes the factorial for n in an iterative way (without recursion).   - Write a Kotlin function that computes the factorial for n in an iterative way (without recursion).
   - Modify the previous function in such a way that is is written as a single expression.   - Modify the previous function in such a way that is is written as a single expression.
-  - Write an operator extension to so that the `!nwill compute n the factorial of n. (Hint: [[https://​kotlinlang.org/​docs/​reference/​operator-overloading.html|Operator Overloading]])+  - Write an operator extension to so that the ''​!n'' ​will compute n the factorial of n. (Hint: [[https://​kotlinlang.org/​docs/​reference/​operator-overloading.html|Operator Overloading]])
   - Write an Int extension function that computes (as Double) the logarithm of its parameter in base ''​this''​. Use it in two ways:   - Write an Int extension function that computes (as Double) the logarithm of its parameter in base ''​this''​. Use it in two ways:
     - ''​2.log(8.0)''​     - ''​2.log(8.0)''​
Line 32: Line 32:
     var s2 = a - b     var s2 = a - b
     var s3 = a * b     var s3 = a * b
-    var s4 = a / b +    var s4 = a == b
-    var s5 = a == b+
     println (s1)     println (s1)
     println (s2)     println (s2)
     println (s3)     println (s3)
     println (s4)     println (s4)
-    println (s5) 
 } }
 </​code>​ </​code>​
mdad/laboratoare/01.1603097427.txt.gz · Last modified: 2020/10/19 11:50 by alexandru.radovici
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0