fork download
  1. #include <stdio.h>
  2.  
  3. int divby3(int n) {
  4. char s[10];
  5. do {
  6. sprintf(s, "%d", n);
  7. n = 0;
  8. int i = 0;
  9. while(s[i])
  10. n += s[i++] - 0x30;
  11.  
  12. }
  13. while (n >= 10);
  14.  
  15. return (n==0) || (n==3) || (n==6) || (n==9);
  16. }
  17.  
  18. int divby5(int n) {
  19. char s[10];
  20. int len = sprintf(s, "%d", n);
  21. n = s[len - 1] - 0x30;
  22. return (n==0) || (n==5);
  23. }
  24.  
  25.  
  26. int main(void) {
  27. printf("%d", divby5(75));
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 4752KB
stdin
Standard input is empty
stdout
1