+ 1

Im trying to solve an average of two numbers, and I cant quite figure out how. Am i overthinking this?

(I just started coding so understand that this is kinda confusing for me) function solveMyAverage(x, y) { x + y = z return z / 2 = q document.write(q) } solveMyAverage(28.56, 39.85)

1st Aug 2017, 12:53 PM
Akili KiKi
Akili KiKi - avatar
3 Réponses
+ 12
function solveMyAverage(x, y) { return (x+y)/2; } document.write(solveMyAverage(28.56, 39.85));
1st Aug 2017, 12:59 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
in here x = 28.56 y = 39.85 so 28.56 + 39.85 = z (please add by yourself^^) and the result is z and z dived by two 😎 and the result of the z / 2 is q . understand ??
1st Aug 2017, 1:00 PM
Art456
Art456 - avatar
0
Thanks both of you. That makes more sense now
1st Aug 2017, 9:17 PM
Akili KiKi
Akili KiKi - avatar