MHB Solve Computing an Average Problem | Help

  • Thread starter Thread starter mjcruzz
  • Start date Start date
  • Tags Tags
    Average Computing
AI Thread Summary
To solve the average of three numbers a, b, and c, use the formula (a + b + c) / 3, as demonstrated with the example (3 + 4 + 8) / 3 = 5. For a general case with n numbers in an array, the average can be calculated by initializing a sum variable N to 0 and iterating through the array to accumulate the total. After the loop, the average is obtained by dividing the total sum N by n. Specifically, for n = 3, the process involves adding each element of the array to N and then dividing by 3. This method effectively calculates the average for any set of numbers.
mjcruzz
Messages
1
Reaction score
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: 128
Technology news on Phys.org
The average of 3 numbers, a, b, and c, is [math]\frac{a+ b+ c}{3}[/math]. With the given example (3+ 4+ 8)/3= 15/3= 5.

You need "avg_sales= (numsales1+ numsales2+ numsales3)/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.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
I am trying to run an .ipynb file and have installed Miniconda as well as created an environment as such -conda create -n <env_name> python=3.7 ipykernel jupyter I am assuming this is successful as I can activate this environment via the anaconda prompt and following command -conda activate <env_name> Then I downloaded and installed VS code and I am trying to edit an .ipynb file. I want to select a kernel, via VS Code but when I press the button on the upper right corner I am greeted...
Back
Top