fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,a=0;
  5. printf("整数を入力してください。:"); scanf("%d",&n);
  6. if(n==0){
  7. a=1;
  8. }else{
  9. while(n!=0){
  10. n/=10;
  11. a++;
  12. }
  13. }
  14. printf("桁数=%d\no",a);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5316KB
stdin
1000
stdout
整数を入力してください。:桁数=4
o