It is possible to tell if a number could be a valid credit card. Credit cards numbers can be validated against an algorithm known as a Luhn. Read this first.
Counting from the check digit, which is the rightmost, and moving left, double the value of every second digit.
Sum the digits of the products together with the undoubled digits from the original number.
If the total ends in 0 (put another way, if the total modulo 10 is congruent to 0), then the number is valid according to the Luhn formula; else it is not valid.
Mod 10+5 Variant Some credit cards use the “Mod 10 plus 5” variant to extend the space of valid card numbers. In this variant, if the sum ends in 0 or 5, the number is considered valid
Before handing in your code, first test it with the LuhnChecker–which I will also use when grading.
A more extensive analysis with good images and an online Luhn Checker