This C++ program takes a user-inputted number as input, uses modulo operations to check if each digit is odd, multiplies the odd digits together, and prints the product of the odd digits or -1 if no digits are odd. It loops through each digit of the number, takes the digit modulo 10 to extract it, checks if it is odd by taking it modulo 2, multiplies the running product by any odd digits, and uses division to remove the rightmost digit after each iteration.
This C++ program takes a user-inputted number as input, uses modulo operations to check if each digit is odd, multiplies the odd digits together, and prints the product of the odd digits or -1 if no digits are odd. It loops through each digit of the number, takes the digit modulo 10 to extract it, checks if it is odd by taking it modulo 2, multiplies the running product by any odd digits, and uses division to remove the rightmost digit after each iteration.
This C++ program takes a user-inputted number as input, uses modulo operations to check if each digit is odd, multiplies the odd digits together, and prints the product of the odd digits or -1 if no digits are odd. It loops through each digit of the number, takes the digit modulo 10 to extract it, checks if it is odd by taking it modulo 2, multiplies the running product by any odd digits, and uses division to remove the rightmost digit after each iteration.