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: 125
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 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
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...
Back
Top