Q:

What is the most efficient to count trailing zeroes in an integer?

normal way is
int main(){
  int a=2000,count=0,temp;
  while(a!=0)
  {
    temp=a%10;
    if(temp==0) count++
    else break;
    a/=10;
  }
  printf("%d",count);
}

Is there a more efficient way ?

A:

For a 32-bit integer (maximum value 2147483647) you only need a maximum of 4 tests. For 64 bits add one more with a test for 16 zeros.
Start with the larger powers of 10 and work down:
int countTrailingZeros(int n)
{
    int zeros = 0;
    if((n % 100000000) == 0)
    {
        zeros += 8;
        n /= 100000000;
    }
    if((n % 10000) == 0)
    {
        zeros += 4;
        n /= 10000;
    }
    if((n % 100) == 0)
    {
        zeros += 2;
        n /= 100;
    }
    if((n % 10) == 0)
    {
        zeros++;
    }
    return zeros;
}

This has a better worst-case performance, but if 9/10ths of the numbers you pass it have no trailing zeros then the average case is worse. It just depends on what values you are passing to it in the typical case.
However, if 9/10ths of the numbers you pass it have no trailing zeros then you probably shouldn't worry about optimizing your original code in the first place since it will break in the first iteration of your loop 90% of the time.

A:

You can adapt the idea of Binary search here.
May be it's difficult to code but it's an idea (as you have asked for most efficient way, I am just presenting this idea).
I am not just talking about 32-bit integer or 64 bit integer.
This works very well when the number of 0's are high otherwise also it should be efficient.
Say your number is n.
First check if n%(10^1) == 0 if yes
then check for  n%(10^2) == 0 if yes
then check for  n%(10^4) == 0 if yes the 10^8 ....10^16. I think you got the idea.
So finally you will get a point where n % 10^(2x) !=0, and now you know that no. of 0's are between x and 2x. 
So again do a binary search starting with x, x+1 ,x+2 ....till you don't find the case where n % 10^(2y) != 0 (x < y <= 2x). Repeat the same process.
The time complexity would be (if you have K 0's) :
Best case will be : 
    O(logK)

Worst case will be:
     ceil(log(K)) + ceil(log(k/2)) + ..... 1 = ~ O(logK)

