Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective: Working with basic types and more with loops and arrays Pin code security check: Write a C program to validate the security pin codes
Objective: Working with basic types and more with loops and arrays Pin code security check: Write a C program to validate the security pin codes in the following way: . It first checks if the pin code entered is six digits. If not, the code is invalid. . It then checks if each digit within the six-digit pin is divisible by 2. If not, the code is invalid. It then checks if the sum of all the digits is less than 30, then the code is invalid. . If ten consecutive invalid pins are entered, the system locks out and reports an intruder. Therefore, codes 357 and 162348 are invalid because the former is less than six digits and the latter has numbers which are not divisible by 2 (i.e. 1 and 3). A valid pin code could be 622248 because it has exactly six digits. In addition, all of its six digits (i.e., 2, 4, 6, and 8) are divisible by 2 and sum of digits (24) is less than 30. A sample interaction is shown below Enter pin code (attempt 1): 1234567 Code 1234 is invalid! Enter pin code (attempt 2): 122534 Code 122534 is invalid! Enter pin code (attempt 3): 642642 Congratulation, code 642642 is valid! If the user entered more than 10 invalid pins: Intruder alert! Note: You can find digits of the pin code and store them in an array first
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started