Question: Write a function that computes the average of the digits in an integer. Use the following function header: double averageDigits(int n) For example, averageDigits

Write a function that computes the average of the digits in an integer. Use the following function header:

Write a function that computes the average of the digits in an integer. Use the following function header: double averageDigits(int n) For example, averageDigits (936) returns 6.0 which is computed as (9 +3+6)/3. Also, write the main function that prompts the user to enter an integer and displays the average of the integer entered.

Step by Step Solution

3.37 Rating (144 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a C program that includes the averageDigits function to compute the average of the digits in a... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!