fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a,b=0;
  5. scanf("%d",&a);
  6. do{
  7. a=a/10;
  8. b=b+1;
  9. }while(!(a==0));
  10. printf("入力された整数は%d桁です",b);
  11.  
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5316KB
stdin
187
stdout
入力された整数は3桁です