Skip to main content
1 of 8
betseg
  • 8.7k
  • 3
  • 28
  • 60

##C, 112 bytes

j,i,k,l;f(char*s){l=strlen(s);for(i=l;j<l;)k+=(s[j++]-48)*(i>1?i--:-1);return!(k%11)&&(k!=0)&&((l==9)||(l==8));}

Returns 0 if invalid, 1 if valid. Try it online!

betseg
  • 8.7k
  • 3
  • 28
  • 60