Number of Digits
Number of Digits
Send Feedback
Number of Digits
Integer n
Count of digits
1 <= n <= 10^6
156
3
7
1
int count(int n){ //write your code here if(n/10==0) return 1; int ans=count(n/10); return ans+1;}
#include<iostream>using namespace std;
int count(int n){ //write your code here if(n/10==0) return 1; int ans=count(n/10); return ans+1;}
int main(){ int n; cin >> n; cout << count(n) << endl;}
Comments
Post a Comment