Question: Postal Code: Write a main () program that prompts the user to enter a 6 digit positive integer which represents the postal code of a
Postal Code: Write a main () program that prompts the user to enter a 6 digit positive integer which represents the postal code of a regain in a city. A. The main() program calls the function checkDigit) which finds and returns the check digit of an integer using the following steps: Finds the digits sum. Finds the reminder by dividing the sum by 10 If the reminder is zero then the check digit is 0 otherwise the check digit is 10 minus the reminder For example, if the integer is 348602, then the digits sum is 3+4+8+6+0+2 reminder of the sum 23% 10 is 3, so the function returns 10-3-7. 23 and the B. The main () program calls the following function postalCode( ) which finds the postal code of the integer by appending the check digit to the right of the integer. For example, if the integer is 348602 and the check digit we found is 7 then the postal code is 3486027 C. The main () program prints the integer and its postal code. Sample inputs/outputs: Enter a positive integer: 821937 The postal code of 821937 is 8219370
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
