Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a pseudo code for this programme Program steps: Message display asking to

ID: 3756213 • Letter: W

Question

write a pseudo code for this programme

Program steps:

Message display asking to input a credit card number.

Number enter between 0 – 20 characters

Asking to input -1 as end of series

Program finds the size of numbers entered – the maximum size of array set to 20

Program displays credit card number

main should call a function passing array and size

Ignore the last (rightmost digit) check digit of the credit card number

Move left, double the value of every second digit and find the sum of these doubled numbers.

If the result of doubling operation is two-digit number, add the digits of doubled number before finding the sum.

print out numbers as the output

Finding sum 2, the sum of all other numbers except last digit.

Printout the numbers of sum1

Should be in order (left to right)

Compute the total of sum1 and sum2 and multiply the result by 9

Checksum is found by extracting the rightmost digit.

End of the programme.

Explanation / Answer

Prompt the user to enter his/her credit card number and Enter -1 at the end of series

Initialize an array of 20 characters, name array as arr

read the card number in arr

intialize i and counter to 0

countArr(arr, counter)

while arr of i is not equal to -1

increment counter

endwhile

Call countArr(arr, counter)

initialize temp, sum, counter1, i, sum2 and temp1 to 0

set counter1 equal to counter

while i is greater than counter

store in temp value at counter index of arr or temp = arr[i]

double the value stored in temp

if temp is less than 10

set sum equal to addition of sum and temp1

while temp is greater than 10

while temp is greater than 0

add temp1 with remainder of temp divide by 10 in temp1

divide temp by 10

endwhile

set sum equal to addition of sum and temp1

endwhile

print sum

set i to sum of i and 2

endwhile

while counter1 is greater than 0

set sum2 equal to sum2 plus remainder of arr[counter] divide by 10

set counter1 equal to counter1 - 1

endwhile

set sum1 equal to 9 times sum of sum1 and sum2