0_0_36398914_32678.cpp: In function 'int main()': 0_0_36398914_32678.cpp:82:22: error: 'j' was not declared in this scope sum+=(i*(n-i))*(a[j]-a[i]); ^