Here is C Program to Count number of digits in number without using mod operator is given below which take any integer number as input and display the number of digits.
C Program to Count number of digits in number without using mod operator
#include<stdio.h>
#include<string.h>
int main() {
int num, digits;
char ch[10];
printf("\nEnter the Number : ");
scanf("%d", &num);
sprintf(ch, "%d", num);
digits = strlen(ch);
printf("\nNumber of Digits : %d", digits);
return(0);
}
output
Enter the Number : 65433
Number of Digits : 5