New course! Every coder should learn Generative AI!
Try a free lesson+ 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
2 Answers
+ 2
for(int i = 1; i ≤ n; i++){
double product = 1;
for(int j = 1; j ≤ i; j++){
product *= i;
}
sum += product;
}
+ 2
thank you