how can i raise each element in an array to it's specific location in the array using the pow function and then sum each raised element for one total figure. For example array[]= {5,4,3} and i want to find the sum of 5^1+4^2+3^3 which should equal 48.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
#include <math.h>
#include <iomanip>
#include <string>
usingnamespace std;
int main()
{
int sum = 0;
int array[]={5,4,3};
int n;
for(int i = 0; i <= n; i++){
sum += pow(array[i],n);
}cout<<sum<<endl;
return 0;
}