0
Geometric mean
Program is supposed to calculate geometric mean_but there is an error upon compiling n running. https://code.sololearn.com/cUo7zrlE7Ibl/?ref=app
5 Réponses
+ 1
Still on line 10. Try to use a floating point number instead of integer for pow() second argument. Integer 1 divided by 3 yields zero. (a * b * c) raised to the power of zero yields 1
pow((a * b * c), 1.0 / n);
+ 1
Super it works bro. God bless
0
Line 10:
pow((a " b * c"), 1 / n);
<n> is an array (defined at line 9). We can't divide `int` by `int` array unless an index was specified to define which element was desired.
(Edit)
Mistaken the {} for [] got me thinking <n> was an array.
0
Int n {3} is not definition of an array. However, I'm wondering why I keep getting the answer 1 every time I run the code even with different values
0
Sorry, my sleepy eyes saw the curly brackets {} like square brackets []. I took a closer look and realised it.