Finding the average | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Finding the average

I was told to make a program that calculates the student's scores in their midterm and finals. That is, -If the sum of the midterm-score and finals-score have a difference of less than 10, then it can be naturally computed as ((midterm+finals)/2). -But if the difference is more than 10, then only print the bigger number. Example: Input: 97 95 Output: 96.00 Example2: Input: 67 77 Output 77.00 Help! My code is working but the first one is not satisfied https://code.sololearn.com/c6a2513A3A3A

19th Jun 2021, 1:39 AM
Eka
Eka - avatar
3 Answers
+ 1
Eka Where did you check difference of finals and midterm scores?
19th Jun 2021, 4:15 AM
A͢J
A͢J - avatar
+ 1
Eka Problem says if difference is 10 or greater than 10 then print max value otherwise print average so you can do like this: https://code.sololearn.com/cWptk5g9qo66/?ref=app
19th Jun 2021, 8:32 AM
A͢J
A͢J - avatar
0
AJANANT Sorry, that was my mistake. I meant that the first example is not satisfied. I edited my code, please check it out.
19th Jun 2021, 5:14 AM
Eka
Eka - avatar