Kindly tell me what mistake have I made in this program? pset1 Credit: (my code) https://pastebin.pl/view/5646dbf1

  • Can you describe your problems? What is or isn't the program doing? Sample output? What have you tried? Any other insight that you have? You need to provide context. Otherwise, you're just asking someone else to do the pset for you.
    – Cliff B
    Oct 19 '20 at 19:38
  • @CliffB, thanks for letting me know that my question looks incomplete. Firstly, I would never want someone else to solve a pset for me! ;) I am unable to use the condition to find out the card type (Eg, AMEX, VISA) It's working just for some cases, not others... Can you please help out in the last block (line 61 onwards to help me understand what's wrong with the logic). Thanks! Oct 21 '20 at 5:17

One thing to consider: in C, ^ is a bitwise-xor operator, not a power-of.

  • So, should I literally put up 13 zeros after 1 for representing 10^13? I didn't find the Bitwise operator in manual.cs50.io Kindly share a reference for Bitwise operator. Thanks! Oct 21 '20 at 5:23
  • en.wikipedia.org/wiki/Bitwise_operations_in_C You could put 13 zeroes. You could also think about capturing the first two digits while you're working with the credit card number.
    – Sentox
    Oct 21 '20 at 6:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .