C Program to count the number of digits entered

 // C Program to count the number of digits entered

#include <stdio.h>  //header file declaration

int main()  //main method

{  

   int p, count=0;            // variable declaration  

   printf("Input Number--");          //Display input number 

   scanf("%d",&p);                         

   while(p!=0)                              

   {  

       p=p/10;  

       count++;  

   }  

   printf("\nThe number of digits are: %d",count);                      //Display output

    getch();  

}  

OUTPUT:




Comments

Popular posts from this blog

C Program to print Fibonacci Series