Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a fortran program for me please with the following algorithm therefore a check-into can be used for validation purpo For example, given the number

image text in transcribed write a fortran program for me please with the following algorithm
therefore a check-into can be used for validation purpo For example, given the number 193456787 the final digit (7) is the check-digit. During this lab we will examine an algorithm that can be used to check the validity of a given number, and write a Portran program to implement this algorithm The algorithm is as follows: Consider the SIN 19 3 4 5 6 7 8 7. Step 1 - Construct a 4 digit number from the 2nd, 4th, 6th and 8th digits of the SIN. Hence, using the given SIN the number would be 9468 Step 2 - Multiply the constructed number in Step 1 by two. 9468 * 2 - 18936 Step 3. Add the digits of the result of Step 2. 1+8+9+3+6 = 27 Step 4 - Construct a 4 digit number from the 1st, 3rd, Sth and 7th digits of the SIN. 1357 im. com/83185/wCont102 2132020 Step 5. Add the digits of the result of Step 4. 1+3+5+7 - 16 Step 6. Add the results of Steps 3 and 5. 27 + 16 = 43 Step 7 - If the result of Step 6 is a multiple of 10 then the check digit is 0. Otherwise the check is 10 - MOD(result of Step 6,10). 10 - MOD(43,10) - 7 Step 8 - If the computed digit in Step 7 is equal to the last digit of the SIN (as it is in this case) it is a valid SIN, otherwise it is invalid. For your program write the following two functions: CreateNum takes 4 integers and returns a 4 digit number SumDigits takes an integer and computes the sum of its digits

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

Students also viewed these Databases questions