Ask Question

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?

+5
Answers (1)
  1. 24 January, 08:53
    0
    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;

    using namespace std;

    int main () {

    double a = 2.334;

    double b = 34;

    double average = (a + b) / 2;

    cout << average;

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “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 ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers