# 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. She will use a variable, avg, to store this average. Which variable type would be most suitable for avg?

Answer:

a variable of type "double" is more suitable for finding average because average could be any number with decimal places. we can't use a variable of type "integer" because it will omit the value after the decimal and will not produce satisfactory results.

Explanation:

an example of C++ code is given to find the average of two numbers a and b

#include <iostream>;

using namespace std;

int main() {

double a = 2.334;

double b = 34;

double average =  (a + b) / 2;

cout << average;

return 0;

}

Rate answer
Wrong answer?

If your question is not fully disclosed, then try using the search on the site and find other answers on the subject Computers and Technology.

Find another answers

Load image
Subjects
Show more