You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
243 B

#include<iostream>
using namespace std;
int main()
{
int n;
float sum=0,sumsq=0,z;
cin>>n;
int s=n;
float ar[s];
for(int i=0;i<n;i++)
{
cin>>ar[i];
sum+=ar[i];
sumsq+=(ar[i]*ar[i]);
}
z=(sum*sum)-sumsq;
cout<<z;
return 0;
}