Question:Count the number of digits in c programming language 

Answer 
#include<stdio.h>
int main(){
  int num,count=0;

  printf("Enter a number: ");
  scanf("%d",&num);

  while(num){
      num=num/10;
      count++;
  }
  printf("Total digits is:  %d",count);
  return 0;
}
Sample output: Enter a number: 23 Total digits is: 2 

+ Report
Total Preview: 433
Count the number of digits in c programming language
Copyright © 2025. Powered by Intellect Software Ltd