Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question 4 subarta is writing a program which will calculate the mean a…

Question

question 4 subarta 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?
string
integer (int)
floating point (float)
boolean

Explanation:

Brief Explanations
  • A String is for text, so not suitable for a number like an average.
  • An Integer (int) can only hold whole numbers, but the mean average might have a fractional part (e.g., the average of 1 and 2 is 1.5).
  • A Floating - point (float) is designed to hold numbers with decimal points, which is perfect for storing a mean average that could have a fractional component.
  • A Boolean is for true/false values, not for numbers. So the most suitable variable type for avg is Floating point (float).

Answer:

C. Floating point (float)