C program to count number of digits in a number

#include<stdio.h>

 int main( )

{
   int n, i=0;
   
   printf("Enter the number");
   scanf("%d",&n);

   while(n>0)

    {
       n=n/10;
       i++;
    }
  
   printf("Number of digits is %d",i);

return 0;

}




Post a Comment

0 Comments