QUESTION IMAGE
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
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
avgis Floating point (float).
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
C. Floating point (float)