Number of Digits
Send Feedback
Integer n
Count of digits
1 <= n <= 10^6
156
3
7
1
SOLUTION:-
#include<iostream>
using namespace std;
int count(int n){
if(n == 0){
return 0;
}
int smallAns = count(n / 10);
return smallAns + 1;
}
int main(){
int n;
cin >> n;
cout << count(n) << endl;
}
This is dummy text. It is not meant to be read. Accordingly, it is difficult to figure out when to end it. But then, this is dummy text. It is not meant to be read. Period.
If you have any doubts then please let me know... ConversionConversion EmoticonEmoticon