Count number of digits in integer

C Program to Count Number of Digits in an Integer.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
	int num, count;

    printf("Enter the number\t:");
    scanf("%d",&num);

    count = 0;
    while(num != 0)
    {
        num = num / 10;
        count++;
    }

    printf("Number of digits\t:%d",count);
    getch();
}

Output

Enter the number        :4521
Number of digits        :4