Need help with While Loop

**I got a problem with this one, hope you guys can help me. I've just learned Java few weeks.**

Write a program segment that reads a natural number n (n>=1) from keyboard, then

calculates and displays the sum of all odd numbers from 1 to n. Use the while loop to

validate input, if the number is smaller than 1, display an error message and the user

can try again.

Sample run:

Please enter a natural number greater than 1: -1

Invalid value. Please enter a natural number greater than 1: 9

Sum of odd from 1 to 9 is: 25

Thanks in advanced.