Im trying to Convert numbers to words from 0-100 only and how do i reexecute the program if it didnt meet the conditions without extiting the program. if i input 55, i want to output Fifty-Five but if i type numbers that are not in 0-100, it will output "you should input 0-100 only try again" then it will automatically go to "input number between 0-100 only"
package convertnumbertowords;
import java.util.Scanner;
public class ConvertNumberToWords {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Input number between 0-100 only ");
int num1 = sc.nextInt();
while (num1 <= -1 && num1 >= 101 ){
if(num1 <= 100 && num1 >= 0){
System.out.println("The "+num1+" in words is "+
Integer.toString(num1));
}
else{
System.out.println("You should input 0-100 only Try Again");
}
}
}
}