fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. printf("Enter the number: ");
  6. scanf("%d",&n);
  7.  
  8. int count=0;
  9. while(n>0){
  10. n/=10;
  11. count++;
  12. }
  13. printf("The no. of digits are %d",count);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5300KB
stdin
1234
stdout
Enter the number: The no. of digits are 4