For this Question: Let's call a positive integer powerful if it has only one non- zero digits. For example, 5000, 4, 1, 10, and 200 are powerful integers whereas 42, 13, 666, 77, and 101 are not.
You are given an integer n. You have to calculate the number of powerful integers x such that 1 &le; x &le; n.The input consists of an integer n.

<b>Constraints</b>
1 &le; n &le; 999999Print one integer denoting the number of extremely round integers x such that 1 &le; x &le; n.<b>Sample Input 1</b>
9
<b>Sample Output 1</b>
9

<b>Sample Input 2</b>
42
<b>Sample Output 2</b>
13, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
int main(){
  int t=1;
 // cin >> t;
  for (int i = 0; i < t; i++){
    int n;
    cin >> n;
    int ans = 0;
    for (int j = 1; j <= 9; j++){
      int x = j;
      while (x <= n){
        ans++;
        x *= 10;
      }
    }
    cout << ans << endl;
  }
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?