Ticker

6/recent/ticker-posts

Count digits Program




Count Digits in a number-

#include <stdio.h>

int main()
{ 
  int n,count=0;
  printf("Enter the number ");
  scanf("%d",&n);
  while (n>0)
  { 
     n/=10;
     ++count;
  }
  printf("%d,",count);
return 0;
}

Output -

Enter the number 1234
4

Post a Comment

0 Comments