Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

number of digits in c++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
    unsigned long long n = 2345423454234542345 ; // the number n
    int  x = floor(log10(n)) + 1 ; // x = the digit count,
    cout << x << endl ; // the largest digit can be handled with 
  											// is unsigned long long 
    return 0;
}
 
PREVIOUS NEXT
Tagged: #number #digits
ADD COMMENT
Topic
Name
2+6 =