+ 1

How to n*n*n*...*n

Task write program, which calculates sequence 1+ 2*2 + 3*3*3 + ... n*n*n*...*n, I know how to write program but I need help how make number value multiply itself until gets his value

24th Jan 2018, 8:07 PM
Martynas
2 Answers
+ 2
for(int i = 1; i ≀ n; i++){ double product = 1; for(int j = 1; j ≀ i; j++){ product *= i; } sum += product; }
24th Jan 2018, 8:15 PM
Jeremy
Jeremy - avatar
+ 2
thank you
24th Jan 2018, 8:16 PM
Martynas