0
Loop up to half the amount of elements. Take the ends (in ascending and descending order) and add the square dd difference. At the end display the calculated sum.
#include <iostream>
#include <cmath>
#define N 6
using namespace std;
int main() {
int AN0], i, soma=0, j;
cout << "Digite o valor do vetor A";
for (i = 0; i < N; i++) {
cin >> A[i];
}
for (i = 0; i < N/2; i++) {
soma += pow((A[i] - A[N-i-1])), 2);
}
cout << "Soma: " << soma << endl
return 0;
}
Note that in your loop you start i with zero value and decrease with each cycle, so you will be in an infinite loop because you will always be less than 6 (at least until an underflow occurs).