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