Assume you are working as a developer in a bank, and you have been asked to develop a program to validate credit card numbers. Assume also that each credit card number consists of 8 digits. The following method is used to verify that the credit is valid or not: - Starting from the rightmost digit, form the sum of every other digit. For instance, if the credit card number is 43589795, then you form the sum 5 + 7 + 8 + 3 = 23. - Double each of the digits that were not included in the preceding step. Add all digits of the resulting numbers. Considering for example the above credit card number 43589795, doubling the digits starting from the next-to-last one, yields 18 18 10 8. Adding all digits in these values yields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27 - Add the sum of the two preceding steps. If the last digit of the resulting sum is 0, the credit card number is valid; otherwise, it is invalid. In our case, 23 + 27 = 50, so the number is valid. Write an Algorithm and Flowchart draw.
Assume you are working as a developer in a bank, and you have been asked to develop a program
to validate credit card numbers. Assume also that each credit card number consists of 8 digits. The
following method is used to verify that the credit is valid or not:
- Starting from the rightmost digit, form the sum of every other digit. For instance, if the
credit card number is 43589795, then you form the sum 5 + 7 + 8 + 3 = 23.
- Double each of the digits that were not included in the preceding step. Add all digits of the
resulting numbers. Considering for example the above credit card number 43589795,
doubling the digits starting from the next-to-last one, yields 18 18 10 8. Adding all digits
in these values yields 1 + 8 + 1 + 8 + 1 + 0 + 8 = 27
- Add the sum of the two preceding steps. If the last digit of the resulting sum is 0, the credit
card number is valid; otherwise, it is invalid. In our case, 23 + 27 = 50, so the number is
valid.
Write an
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images