Write the followings as separate three functions that 1. checks if an integer is five-digit and returns the result as an integer value (1 for true, O for false) (hint: you can either check the range...


Write the followings as separate three functions that<br>1. checks if an integer is five-digit and returns the result as an integer value (1 for true, O for<br>false) (hint: you can either check the range or find the length of the number)<br>2. returns the sum of the digits of any given integer (hint: use modulus and division operators)<br>3. takes an integer as its first parameter, returns the left most and right most digit of that<br>number. (Notice that it returns 2 results at the same time) (hint: use pointers as function parameters,<br>call the function by references)<br>Write a main that uses the above 3 functions to find the sum of the digits and displays the left most and<br>right most digits of given integers. The program stops when a five-digit number is entered.<br>Example Run:<br>Enter a digit number (to stop enter a five-digit number): 456735<br>Sum of digits = 30<br>Left most digit is: 4<br>Right most digit is: 5<br>

Extracted text: Write the followings as separate three functions that 1. checks if an integer is five-digit and returns the result as an integer value (1 for true, O for false) (hint: you can either check the range or find the length of the number) 2. returns the sum of the digits of any given integer (hint: use modulus and division operators) 3. takes an integer as its first parameter, returns the left most and right most digit of that number. (Notice that it returns 2 results at the same time) (hint: use pointers as function parameters, call the function by references) Write a main that uses the above 3 functions to find the sum of the digits and displays the left most and right most digits of given integers. The program stops when a five-digit number is entered. Example Run: Enter a digit number (to stop enter a five-digit number): 456735 Sum of digits = 30 Left most digit is: 4 Right most digit is: 5
Enter a digit number (to stop enter a five-digit number): 142212<br>Sum of digits = 12<br>Left most digit is: 1<br>Right most digit is: 2<br>Enter a digit number (to stop enter a five-digit number): 961862<br>Sum of digits<br>= 32<br>Left most digit is: 9<br>Right most digit is: 2<br>Enter a digit number (to stop enter a five-digit number): 12345<br>

Extracted text: Enter a digit number (to stop enter a five-digit number): 142212 Sum of digits = 12 Left most digit is: 1 Right most digit is: 2 Enter a digit number (to stop enter a five-digit number): 961862 Sum of digits = 32 Left most digit is: 9 Right most digit is: 2 Enter a digit number (to stop enter a five-digit number): 12345

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here