fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4. int number = 109001231 , digits = 0;
  5. int temp = number;
  6. while( temp > 0 )
  7. {
  8. temp /= 10;
  9. ++digits;
  10. }
  11.  
  12. std::cout << number << " is " << digits << " digits." << std::endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
109001231 is 9 digits.