double sum = (n1, n2);
Function prototype does not use assignment operator =. You just need the types of the parameters it takes, not the actual names.
double sum (double, int);
cout<<"the average is" <<sum<<endl;
Function call - uses () to indicate function call and names of arguments to be sent.
cout<<"the average is " <<sum(n1,n2)<<endl;
double sum= (n1, n2)
Function definition does not use assignment operator =. Include the types of the arguments along with the names.
double sum(double n1, int n2)
Edit - I usually try to avoid using the same name of variable in multiple functions.