My code is showing logical error. Please can someone assist | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My code is showing logical error. Please can someone assist

https://code.sololearn.com/c5WKH0Nn26SR/?ref=app

20th Jan 2022, 3:54 AM
Alusine T. Lavalie
Alusine T. Lavalie - avatar
3 Answers
+ 1
What logical error? describe the problem clearly please ...
20th Jan 2022, 4:11 AM
Ipang
+ 1
Alusine t Lavalie the logic seems okay. I noticed line 12 is performing integer math and storing the result in a double. If you divide by 3.0 instead of 3, then it will calculate the floating point avg.
20th Jan 2022, 4:39 AM
Brian
Brian - avatar
0
double avg =(sub1+sub2+sub3)/3.0; In place of double avg =(sub1+sub2+sub3)/3;
20th Jan 2022, 11:22 AM
Adi Nath Bhawani
Adi Nath Bhawani - avatar