0

Plzz explain this algo

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

14th Aug 2018, 3:12 PM
White code
White code - avatar
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]
14th Aug 2018, 3:17 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
+ 9
if the input goes in "i" 2 * i = 6 6 * 6 = 36 assuming sum = 20 sum = 20 + 36 sum = 56
14th Aug 2018, 3:21 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
+ 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?
14th Aug 2018, 9:29 PM
Jang Jaeung
Jang Jaeung - avatar
0
input is 3 and output 56 explain
14th Aug 2018, 3:19 PM
White code
White code - avatar
0
2*2+ 4*4+6*6= 56 ....
14th Aug 2018, 3:23 PM
White code
White code - avatar