fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int n;
  6. int sum=1;
  7. scanf("%d" ,&n);
  8. while(n>=10){
  9. n = n/10;
  10. sum = sum + 1;
  11. }
  12. while(n<=-10){
  13. n = n/10;
  14. sum = sum + 1;
  15. }
  16. printf("%d", sum);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5280KB
stdin
100
stdout
3