Assignment #2 - 93B

# Assignment #2 - 93B

```#2 93 A
Course: 308 208
T.A   : Silas Rahhal
ID    : HYJF
Due   : .........

SOCIAL INSDURANCE NUMBER VALIDATION PROGRAM
___________________________________________

Write a 'C' program to validate the accuracy of any Social
Insurance Number (SIN). ( or to impress others by guessing the
last digit, given the first eight digits ).

The Social Insurance Number contains nine digits. ( the first
eight digits are assigned, while the ninth is constructed from
the first eight, and therefore acts as a check-digit).

Ex: SIN =  1    9    3    4    5    6    7    8    7
1st  2nd  3rd  4th  5th  6th  7th  8th  check-digit

Steps: ( High Level Specifications ).
______________________________

(1) Construct a 4 digit number from the 2nd, 4th, 6th and 8th
digit of the SIN.         ie. 9 4 6 8

(2) Multiply the constructed digit in step (1) by two.
ie. 9 4 6 8   *  2  = 1 8 9 3 6

(3) Cross add all the resulting digits of step (2).
ie. 1+8+9+3+6   = 27

(4) Construct a 4 digit number from the 1st, 3rd, 5th and 7th
digit of the SIN          ie. 1 3 5 7

(5) Cross add all the resulting digits  of step (4).
ie. 1+3+5+7 = 16

(6) Add the results of step (3) and (5) together.
ie. 27 + 16 = 43

(7) If the result of step (6) is a multiple of 10 then
the check digit is 0
Otherwise the check is 10 - MOD(results of step (6) , 10 )
ie. 10 - MOD(43,10) = 7

Test you program on the following SIN numbers:

111111111
222222222
333333333
444444444
555555555
666666666
777777777
888888888
999999999
205446651
193456787
3 more numbers (be creative)...

Requirements:

1) use of array(s).
2) use of loop(s).
3) nicely formatted output, with message and correct check digit, as
below.

S.I.N            Message       Correct Check-Digit
_________        _______       ___________________

111111111        Wrong SIN            8
222222222        Wrong SIN            6
333333333        Wrong SIN            4
444444444        Wrong SIN            2
555555555        Wrong SIN            6
666666666        Wrong SIN            4
777777777        Wrong SIN            2
888888888        Wrong SIN            0
999999999        Wrong SIN            8
205446651        Correct SIN          1
193456787        Correct SIN          7
3 more numbers (be creative)...

your program should prompt the user for a Social Insurance Number,
validate it, and print the Message as above, with the Correct
Check-Digit.

You may need to convert the characters enterd by the user, into
integer using the "atoi" function.

Your program should loop until the user enters a special character
as a social insurance number.

NOTE: We assume that if the Check-Digit is correct, then the SIN is
a valid number.

-+-+-+-+-+-+-+-+-+-+-+-+-+ END -+-+-+-+-+-+-+-+-+-+-+--+-+
```