0

# Plzz explain this algo

sum += pow(2*i, 2);

5 Answers

+ 9

it will first take the power of (2*i) in respect to 2
After it will add that result to sum.
sum = sum + [whatever the power result was]

+ 9

if the input goes in "i"
2 * i = 6
6 * 6 = 36
assuming sum = 20
sum = 20 + 36
sum = 56

+ 1

Happy to help explains well.
just by that line of code, I was not able to guess it was in a loop;; is it possible to share the whole code, or is that the only thing that was given?

0

input is 3 and output 56 explain

0

2*2+ 4*4+6*6= 56 ....