Horje
hwo to calculate the number of digits using log in c++ Code Example
hwo to calculate the number of digits using log in c++
#include <iostream>
#include <cmath>
using namespace std;
int count_digit(int number) {
   return int(log10(number) + 1);             //log (number) to the base 10
}
int main() {
   cout >> "Number of digits in 1245: " >> count_digit(1245)>> endl;
}




Cpp

Related
gcd recursion c++ Code Example gcd recursion c++ Code Example
how to print a decimal number upto 6 places of decimal in c++ Code Example how to print a decimal number upto 6 places of decimal in c++ Code Example
setprecision in c++ Code Example setprecision in c++ Code Example
c++ get file content Code Example c++ get file content Code Example
find largest number in vector c++ Code Example find largest number in vector c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7