fun main(args:Array<String>) { for (item in 1..5) { println("hey theree $item") } }
- OUTPUT
- hey theree 1
- hey theree 2
- hey theree 3
- hey theree 4
- hey theree 5
fun main(args:Array<String>) { for (item in 0..6) { if (item % 2 ==0) {//if the no is divisible by 2 or multiple of 2 println(" $item is multiple of $item fizz") } else if(item%3==0) { println("buzz") } } }
- OUTPUT
- 0 is multiple of 0 fizz
- 2 is multiple of 2 fizz
- buzz
- 4 is multiple of 4 fizz
- 6 is multiple of 6 fizz
0 comments:
Post a Comment