I am trying to create a program to validate 10 to 12 digit long number sequences based on the luhn algorithm, but my program keeps on telling me that every number is invalid
You should be subtracting '0' from tmp, not 0. Subtracting 0 returns the ASCII value, which you don't want.