Count rotations which are divisible by 10 | C ++ implementation to find the count of 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countRotation ( int n ) { int count = 0 ; do { int digit = n % 10 ; if ( digit == 0 ) count ++ ; n = n / 10 ; } while ( n != 0 ) ; return count ; } int main ( ) { int n = 10203 ; cout << countRotation ( n ) ; }