Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Enter an integer of any length from the keyboard, and take out the odd numbers in the number to form a new number.
Enter an integer of any length from the keyboard, and take out the odd numbers in the number to form a new number.
First take out this integer one by one, divide it by 10, take the remainder and put it into the array; Then it is judged whether each number in this array is odd, and if it is, it is added to an integer variable in the form of 10. For example:

The integer 253698 is decomposed into an array: [a]={8, 9, 6, 3, 5, 2}, and then a[5] is judged as an even number in reverse order and discarded; A[4] is an odd number, and the variable n = 5;; Then a[3] is odd, then n number = 10 * n number+a [3]; And so on.