Solve Computing an Average Problem | Help

In summary, to calculate the average of n numbers, you can use the formula N/n, where N is the sum of all the numbers and n is the total number of numbers. This can be achieved by a loop that adds each number in an array and then divides the sum by the total number of numbers.
  • #1
mjcruzz
1
0
I can't seem to understand how to solve this problem. Please help
 

Attachments

  • Screen Shot 2021-01-30 at 8.20.30 PM.png
    Screen Shot 2021-01-30 at 8.20.30 PM.png
    205.7 KB · Views: 69
Technology news on Phys.org
  • #2
The average of 3 numbers, a, b, and c, is \(\displaystyle \frac{a+ b+ c}{3}\). With the given example (3+ 4+ 8)/3= 15/3= 5.

You need "avg_sales= (numsales1+ numsales2+ numsales3)/3"
 
  • #3
More generally, if you have n numbers, given as an array, num, and want to calculate their average it is
N= 0
for (i= 0; i< n; i++)
N= N+ num
Average= N/n;

In the case that n= 3, N would start at 0, after the i= 0 loop, N= 0+ num[0]= num[0], after the i= 1 loop, N= num[0]+ num[1], and after the i= 2 loop, N= (num[0]+ num[1])= num[2]= num[0]+ num[1]+ num[2]. The loop stops there because i= 3 does not satify "i< 3", and then Average= (num[0]+ num[1]+ num[2])/3.
 

1. What is an average computing problem?

An average computing problem is a mathematical problem that involves finding the average or mean value of a set of numbers. This is typically done by adding all the numbers together and then dividing by the total number of numbers in the set.

2. Why is it important to solve computing an average problem?

Computing an average is important in various fields such as statistics, economics, and science. It allows us to summarize and make sense of a large set of data by providing a single representative value.

3. What is the formula for computing an average?

The formula for computing an average is: average = sum of numbers / total number of numbers.

4. What are some common mistakes when solving an average computing problem?

Some common mistakes when solving an average computing problem include forgetting to include all the numbers in the set, using the wrong formula, and rounding incorrectly.

5. Can an average computing problem be solved with any set of numbers?

Yes, an average computing problem can be solved with any set of numbers, as long as they are all numerical values. However, the result may not be meaningful if the numbers in the set are not related or if there are extreme outliers.

Similar threads

  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
1
Views
641
  • Programming and Computer Science
Replies
29
Views
3K
  • Programming and Computer Science
Replies
15
Views
2K
  • Atomic and Condensed Matter
Replies
1
Views
795
  • Introductory Physics Homework Help
Replies
1
Views
600
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
Back
Top