C Program to Count the Number

#include <stdio.h>

#include<conio.h>

void main() 

{

    int n, count=0;

    clrscr();

    printf("Enter Number\n ");

    scanf("%d", &n);

    while (n != 0) 

   {

        n = n/10;

        ++count;

    }

    printf("Number of digits: %d", count);

    getch();

}


Output


Enter Number: 654896

Number of digits: 6