Is amrstrong number code to count the number of digits

how to count the number of digits in input? i mean i know that how to extract digits that is input%10…nut how will i count that how many number of digits are there?

Hey @Anku47

int temp=n; //the number whose digits we have to count
int count=0;
while(temp!=0){
temp=temp/10; //this removes one char from number
count++;
}
cout<<count; //HERE count tells the number of digits

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.