Count rotations which are divisible by 10 | Function to return the count of all the rotations which are divisible by 10. ; Loop to iterate through the number ; If the last digit is 0 , then increment the count ; Driver code
function countRotation ( n ) { let count = 0 ; do { let digit = n % 10 ; if ( digit == 0 ) count ++ ; n = parseInt ( n / 10 ) ; } while ( n != 0 ) ; return count ; } let n = 10203 ; document . write ( countRotation ( n ) ) ;