Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in Unix Write a C program, called SIN_validate, to validate Canadian SIN numbers stored in a file. Only Unix in- put/output system calls can be
in Unix
Write a C program, called SIN_validate, to validate Canadian SIN numbers stored in a file. Only Unix in- put/output system calls can be used when reading from the file. The input file, a text file, consists of SIN numbers, one per line. Your program should open the input file and read the SIN numbers, one at a time as a string. For each SIN number, your program should check whether it is valid. Then, prints to the screen, using system call write0, the SIN number followed by either VALID, or NON VALID. You have to handle possible system call fails by printing the appropriate message, using perrorO and exiting. Synopsis: validateslN A Canadian SIN is a 9-digit string that can be validated by checking its digits, following Luhn algorithm, see https://en.wikipedia.org/wiki/social Insurance Number. ere is an example of how it works: 024462284 121212121 a SIN, digit-wise Multiplication by this number, the result is given below: 0 448642 16 4 Then, add all of the digits together (note that 16 is 1+6): 0+4+48 +642 1+6 439
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