fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int decimal_value = 1023;
  8. int numOfDigits;
  9. double result = log2(decimal_value);
  10. numOfDigits = floor(result+1);
  11. cout << numOfDigits;
  12. return 0;
  13. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
10