DevJourney · code I wrote while learning
main.cpp
227 Bclass Solution {
public:
int countDigit(int n) {
if (n == 0)
return 1;
int count = 0;
while (n != 0) {
count++;
n /= 10;
}
return count;
}
};