Computer Science, asked by aaryasancheti20, 9 months ago

please find this error.
if it's helpful I will mark as brainliest.
do not spam​

Attachments:

Answers

Answered by sumanadhya30
1

Error:

Compilation failed due to following error(s).Main.java:13: error: incompatible types: possible lossy conversion from double to float

float avg= 0.0;

Explanations:

A double is a floating point number with double precision, a float is a floating point number with single precision. If you just write 0.0 then it is interpreted as a double. To use the float type you have to write it as 0.0f

Answer:

Use

double avg = 0.0;

Or,

float avg = 0.0f;

avg = sum/3.0f;

Similar questions