public class OddNum {
public static void main(String[] args) {
//Scanner
Scanner sc = new Scanner();
("Welcome*lit. remove even and take odd (idiom); to eliminate even and replace it with odd*Reorganization tools0.1block of printing");
while (true) {
//input
("Enter positive integer (0 exit):");
//convert the input numbers to String array
int num = ();
if (num == 0) {
(-1);//Enter a 0 and the JVM exits.
}
String[] inputNum = (num + "").split("");
String pri = "You entered a:" + + " Integer of bits.";
//If the number entered is less than 0 or greater than the maximum value that can be represented by int, prompt the number is invalid and start the input again.
if (num < 0||num>Integer.MAX_VALUE) {
(pri);
("The number you entered is invalid. Re-enter it.");
continue;
}
(pri);
String oddNum = "";
// a new string
// Get every number, i.e. array element
for (int i = 0; i < ; i++) {
//Fetched elements converted to int numbers
int a = (inputNum[i]);
// determine if the number is odd, if so splice the string
if (a % 2 != 0) {
oddNum = oddNum + a;
}
}
// Judge whether the last spliced string is empty or ""; if all inputs are even, there will be an empty string
if (oddNum != null && !("")) {
// Convert spliced numeric strings into int outputs
((oddNum));
} else {
("There's no number you're looking for.");
}
}
}
}