Respuesta :
A single line statement that computes the average would be:
avg_sales = (num_sales1 + num_sales2 + num_sales3) / 3;
You have to keep in mind that this would work in programming languages like Python. The IDLE platform will automatically give the answer in a form of a Double, thus giving you the decimal place automatically.
If you are coding in Java, you will have to declare the double in the single line statement.
avg_sales=(double)(num_sales1 + num_sales2 + num_sales3) / 3.0;
This is also assuming the you have declared "avg" as a double beforehand.
Following are the Python program to calculate the average value.
Program Explanation:
- Defining variables "num_sales1, num_sales2, and num_sales3" that holds integer value that is "3, 4, and 8".
- In the next step, another variable "avg_sales" is declared that holds a value "0".
- Inside the "avg_sales" we calculate the average value of the above input value and use the print method that prints its value.
Program:
num_sales1 = 3#defining variable that holds integer value
num_sales2 = 4#defining variable that holds integer value
num_sales3 = 8#defining variable that holds integer value
avg_sales = 0#defining variable that holds integer value
avg_sales = (num_sales1 + num_sales2 + num_sales3) / 3#using avg_sales variable that calculates average value
print(avg_sales)#print average value
Output:
Please find the attached file.
Learn more:
brainly.com/question/15170131
![Ver imagen codiepienagoya](https://us-static.z-dn.net/files/db6/de4be2393b7bd6ea061b5d322d98b827.jpg)