Write a program that prompts the user to enter the 12 digits ofa barcode separated by spaces. The program should store the digitsin an integer array, calculate the check digit, and compare it tothe final barcode digit. If the digits match, output the barcodewith the message “validated.” If not, output the barcode with themessage “error in barcode.” Also, output with labels the resultsfrom steps 1 and 2 of the check-digit calculations. Note that the“first” digit of the barcode will be stored in element 0 of thearray.
Try your program on the following barcodes, three of which arevalid. For the first barcode,
OR
OR