/****************************************************
* Program to count the number of digits in a number
*****************************************************/
#include<stdio.h> // include stdio.h
int main()
{
long int num;
int count = 0, rem;
printf("Enter a number: \n");
scanf("%ld", &num);
while (num != 0)
{
rem = num % 10; // get the last digit of num
num = num / 10; // remove the last digit from num
count++; // increment count by 1
}
printf("%d", count);
return 0;
}