write C# console app No arrays Credit card validation Problem. A credit card number must be between...

80.2K

Verified Solution

Question

Programming

write C# console app No arrays

Credit card validation Problem. A credit card number must bebetween 13 and 16 digits. It must start with: –4 for visa cards –5for mater cards –37 for American express cards –6 for discovercards •Consider a credit card number 4380556218442727 •Step1:double every second digit from right to left. If doubling of adigit results in a two-digit number, add up the two digits to get asingle-digit number. •Step2: now add all the single digit numbersfrom step1 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 •Step3: add all digits inthe odd places from right to left in the card number 7+ 7 + 4 + 8 +2 + 5 + 0 + 3 = 36 •Step4: sum the results from step 2 and step 337 + 36 = 73 •Step 5: if the results from step 4 is divisible by10, the card number is valid; otherwise, it is invalid. In thiscase, the card number is not valid – because 75 not divisible by10. use modulus operator

Answer & Explanation Solved by verified expert
3.7 Ratings (702 Votes)
using System using SystemLinq using SystemText using SystemIO namespace SO class Program static void Mainstring args string cards new string 378282246310005    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students