Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Social Inurance Numbers (SINs) are validated wing a simple check dgt process known as the Luhn Algorithm described below Assignment Write a C program that

image text in transcribed
image text in transcribed
Social Inurance Numbers (SINs) are validated wing a simple check dgt process known as the Luhn Algorithm described below Assignment Write a C program that reads a sequence of nine digit mumbers from a file and outputs each number with a message indicating whether it is or is not a valid SIN. You can use a negative number at the end of the Ble to signal the 2 of 3 end of data or you can use the file handling features e Cto determine the You should read the numbers from the file as integers and define a function that extracts the individual digts into an array. You should use this array in performing the venification stepsYou can use the same function to extract digits for the values descrbed in the methodology below. The file used to test your program should include the folowing numbers: 9995993 Write the output to a file. Each line in the le should have the number and a message as to whether or hot Methodelegy A SIN consists of nine digits For example, 193456787 The verification can be t is vald as follows 1. Construct a four dgit number from the digits in even mumbered positions (2, 4, 6,B) e-9 946 2. Multiply the number by 2 e.g. 18936 3. Add the digits of the number obtained in step 2 e.g. 1+8+9+3+6-27 4. Construct a five digt number from the digits in odd mumbered positions (1, 3,5, 7.9) eg.13577 5. Add the digits of the number from step 4

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_2

Step: 3

blur-text-image_3

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

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions

Question

Explain the factors affecting dividend policy in detail.

Answered: 1 week ago

Question

Explain walter's model of dividend policy.

Answered: 1 week ago