//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Problem 1.3 on page 20


public class Pr0103
{ public static void main(String[] args)
  { int n=1;
    while (n>0)
    { System.out.println("numberOfDigits(" + n + ") = " + numberOfDigits(n));
      n *= 2;
    }
  }
  
  public static int numberOfDigits(int n)
  { if (n<0) n = -n;
    int count=0;
    while (n>0)
    { n /= 10;
      ++count;
    }
    return count;
  }
}
