# Tag Info

3

From the spec: American Express numbers all start with 34 or 37; This example starts with 36, and thus is invalid. The second error is similar. Review the spec for how to identify a Master Card.

1

ok so when you are doing this -> " int t = n % 100000000000000/1000000000000;" The '/' sign is dividing your 1000000000.. by 1000000... I think you meant to use '/' sign as a symbol for 'or'. The resultant x or y are not single digits. Besides you are making this code unnecessarily long and complicated. i would suggest you to go through the ...

1

Having problems with this? temp_b /= (10 ^ 14); That would be because the ^ operator is not an exponent operator as it is in mathematics. It's the exclusive or operator. You might try a call to pow(). As for float issues, I didn't see any floats in the code at all. If this answers your question, please click on the check mark to accept. Let's keep up on ...

1

When you say number /= 10, you are actually reducing the number variable itself. So after counting and getting the value for count, the value of number is equal to zero

1

The second to last digit is doubled, from there every second digit. 3 7=>1+4 8 2=>4 8 2=>4 2 4=>8 6 3=>6 1 0=>0 0 0=>0 5 Sum is 3+(1+4)+8+4+8+4+2+8+6+6+1+0+0+0+5, total 60. This is divisible by 10.

1

Yes, you can return a char, if you do it right. The code above is designed to return a char, but you are assigning integers (1, 2, 3) to credit_card_status. A char also behaves like a signed int. Because of this, the code is actually taking those numbers and treating them like ASCII values. So, it means that the function interprets those digits as ASCII ...

Only top voted, non community-wiki answers of a minimum length are eligible