text: Convert to number with digits as 3 and 8 only | Java to find min operations required to convert into charming number ; function for minimum operation ; remainder and operations count ; count digits not equal to 3 or 8 ; Driver code
code: class GFG { static int minOp ( int num ) { int rem ; int count = 0 ; while ( num > 0 ) { rem = num % 10 ; if ( ! ( rem == 3 rem == 8 ) ) count ++ ; num /= 10 ; } return count ; } public static void main ( String [ ] args ) { int num = 234198 ; System . out . print ( " Minimum ▁ Operations ▁ = " + minOp ( num ) ) ; } }