Write a function, called digits function that is able to calculate the number of digits and the summation of the digits.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Write a function, called digits function that is able to calculate the number of digits and the summation of the digits.

Post by answerhappygod »

Write A Function Called Digits Function That Is Able To Calculate The Number Of Digits And The Summation Of The Digits 1
Write A Function Called Digits Function That Is Able To Calculate The Number Of Digits And The Summation Of The Digits 1 (96.89 KiB) Viewed 34 times
Write a function, called digits function that is able to calculate the number of digits and the summation of the digits. The input of this function is N (entered number) and the outputs are number digits and sum digits. (4 marks) Write a function, called print average function that is able to calculate the average of 3 numbers and print it. The inputs of this function are a, b and c. No output is required. (3 marks) Write a function, called prime function that receives one parameter n, and checks whether the number is prime or not. The input of this function is n and the output is result prime. (4 marks) Now after you created the three functions, you have to write a program that can call the above functions according to the user's choice. Write a menu driven that allows the user to select from the following options (4 marks) To use the digits function you have to enter 1. To use the average function you have to enter 2. To use the prime function you have to enter 3. To Exit the program you have to enter 4. Once the user select one of the above choices you have to read the value entered by the user and then to call the respective function. If the user entered a number that is not equal to 1 or 2 or 3 or 4, the program should ask the user to re-enter again. Then, you have to use "input" to enter the values of the variables (inputs of the functions). For the digits function, you have to enter only positive number. For the average function, you have. to enter greater than or equal to zero values and for the prime function you have to enter greater than 1 values. For all of the functions, the program should ask the user to re-enter again if the user entered wrong numbers.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply