#include <iostream>
#include <iomanip>
#include <cmath>
/**
* Calculates the number of digits before the decimal point in a positive double.
* For example, 89.560873 → 2 digits before the decimal.
*/
int countIntegerDigits(double value) {
if (value == 0.0) return 1;
return static_cast<int>(std::log10(std::abs(value))) + 1;
}
int main()
{
double n = 89.560873;
// Get number of digits before the decimal point
int digitsBeforeDecimal = countIntegerDigits(n);
std::cout << digitsBeforeDecimal<< std::endl;
}
/*
run:
2
*/