fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int n,count=0;
  6. scanf("%d",&n);
  7. if(n>0)
  8. {
  9. for(;n>0;)
  10. {
  11. n=n/10;
  12. count++;
  13. }
  14. }
  15. else
  16. count=-1;
  17. printf("%d",count);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 2172KB
stdin
Standard input is empty
stdout
9