Computer Science, asked by gauprisan, 9 months ago


The following C++ code segment is a part
of a program written by Smitha to find

int a, b, c;
float avg;
cin>>>>b>>c;
avg = (a+b+c)/3;
cout<<avg;
What will be the output if she inputs 1, 4
and 5 ? How can you correct it ?

Answers

Answered by sahasuparno
0

Answer:

3.33333333

Explanation:

the average of 1 4 and 5 is

3.333333333333333.....

but float has 8 decimal points

Similar questions