1#include <iostream>
2#include <cmath>
3
4unsigned int getNumberOfDigits (int i)
5{
6 return i > 0 ? log10((double) i) + 1 : 1;
7}
8
9int main()
10{
11 std::cout << "Number of digits: " << getNumberOfDigits(/*Example*/6738) << std::endl;
12 return 0;
13}