Saturday, 30 December 2017

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;

}




No comments:

Post a Comment

Featured Post

TCS Latest Test Patern ( For On-Campus Drives )

Tata Consultancy Services is software services consulting company whose  headquarter is situated in Mumbai, India. It is the Asia’s larges...