Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1. Function
- f(x) = x*x + 2x +3
- f(1) = 1*1 + 2*1 + 3
- f(1) = 6
- f2(x, y) = x*x + 2y + 3
- f2(1, 2) =
- fun nama_function (parameter) {
- //statement
- }
- */
- fun f ( x : Int ) {
- val rumus = x*x + 2*x + 3
- println(rumus)
- }
- fun f2 ( x : Int, y : Int ) {
- val rumus = x*x + 2*y + 3
- println(rumus)
- }
- fun main(){
- f(1)
- f(2)
- f(3)
- f(4)
- f(5)
- f(6)
- f(7)
- f(8)
- f(9)
- f(10)
- f2(1, 2)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement