In: Computer Science
I'm writing a program that requires that I use the check sum technique with a for loop. A student enters their seven digit ID number. The seventh digit is determined from the other digits by this formula:
7th digit = (1 *(1st digit) + 2 * (2nd digit) + ... + 6 * (6th digit)) %10.
The program should prompt users to enter a 7-digit number, and print valid if the actual 7th digit matches the computed 7th digit. Basicaly, an ID of 1234567 is invalid but 1234561 IS valid because the first and seventh digit are equal.
I can do this with a while loop but I must use a for loop.
Hi,I wrote the code in C using for-loop.Hope,it will help you.Any other further doubts.Please feel free to ask if any other further doubts.We love to help you