Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

5. Arranging for the training facility and room.

Answered: 1 week ago