write a
program which will accept one
integer argument and returns
count of digits of that argument
using (((class to basic conversion.))))
#include <bits/stdc++.h>
using namespace std;
void count_digits(int n)
{
string num = to_string(n);
cout << num.size() << endl;
}
int main()
{
int n = 345;
count_digits(n);
return 0;
}
Comments
Leave a comment