10.0k views
5 votes
Subana is writing a program which will calculate the mean average of a set of numbers by adding the numbers and dividing the result by the amount of numbers. What variable will she use?

User Cydparser
by
8.5k points

2 Answers

4 votes

Answer:

Data Type: Double (decimal)

Variable Name: avg

Step-by-step explanation:

An average of numbers will typically give you a decimal answer. Therefore, you should use the Double data type.

User Robert Fines
by
7.8k points
3 votes

Answer:

double mean

double sum

double number

int count

Step-by-step explanation:

There are many options to code a program for mean calcultation. This one is one of the simplest. First of all, get the numbers and increase the value of count by 1 each time new number is added. Then add the incoming numbers one by one performing the summation of all the input numbers on the variable sum; the final step is the calcultation of the mean by diving the variable sum by the variable count. With those variables ready, then Subana can make the code work properly.

User JanLauGe
by
8.6k points