Bellow is some Java code for the question:
int total1 = 0;
int total2 = 0;
for (int x = 0; x <= n; x++)
total1 = total1 + x;
for (int y = 1; y < n; y++)
total2 += total1 * y;
Based on the question above, I do an answer likes bellow. Please help me check my answer right or wrong. Thanks for your helping.
Operation Number of operations
-------------------------------------
Assignment n² + 1
Addition n²
Multiplication n²
Total Operation 3n² + 1