소숫점자릿수

    C언어 소수점의 자릿수 구하기

    #include #include double targetValue = 0.988; double temp = targetValue; int count = 0; while(temp){ count++; temp = targetValue * pow(10,count); temp = fmod(temp,1.0); //실수 mod 연산 } printf("소수점 자릿수: %d",count);