You are on page 1of 1

#include <cmath>

#include <iostream>
int main( int argc, char* argv[] )
{
int long number = 0;
int digits = 0;
for( int x = 0; x < 25; x++ )
{
number = rand();
number != 0
// digits = floor( log10( abs( number ) ) ) + 1;
digits = floor( log10( abs( number != 0 ? number : 1 ) ) ) + 1;
std::cout << "Original Number is: " << number << std::endl;
std::cout << "Number of digits is: " << digits << std::endl;
std::cout << std::endl;
}
return 0;
}

You might also like