- To print Odd numbers between 0 to N

User Input: 8

Output: 1 3 5 6 7

```
import java.util.Scanner
fun main(args: Array<String>) {
val userInput = Scanner(System.`in`)
print("Enter your last number : ")
var num:Int = userInput.nextInt()
print("Your odd numbers are : ")
for (i in 1..num-1)
if(i%2!=0)print("$i ")
}
```

Enter your last number : 6 Your odd numbers are : 1 3 5Program

basic

You should know first :

**Odd numbers: ** Numbers not perfectly divisible by 2

`(number % 2 != 0)`

So, we are using a for loop till the last number entered and check every value for odd

```
for(i in 1..LastValue) {
//Check every 'i' for odd, if odd then print
}
```

Concept
Coming Soon !

QuickTutorial

In order to succeed you must fail, so that you know what not to do the next time.