Source of numberOfTimes3IsAFactor.cpp


  1: //numberOfTimes3IsAFactor.cpp

  3: #include <iostream>
  4: using namespace std;

  6: int numberOfTimes3IsAFactor
  7:     (
  8:     int n //in
  9:     )
 10: {
 11:     if (n % 3  !=  0)
 12:         return 0;
 13:     else
 14:         return 1 + numberOfTimes3IsAFactor(n / 3);
 15: }