Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include <iostream> #include <cmath> using namespace std; int main() { double x = 1260.0; int digits = floor( log10( x ) ) + 1; cout << "The number " << x << " has " << digits << " digits."; return 0; }
The number 1260 has 4 digits.