#include<iostream>usingnamespace std;
void sum(double& sum,int n){ //sum is a reference, so any change of sum will//be reflected in the variable passed by the calling function.////n is passed to the function from the caller,// so there is no need to have the user enter it here.for (int i=1;i<=n; i++){
sum +=1.0/i;
}
}
int main(){
double k=0;
int j=10;
sum(k,j); //k and j are used by sum
cout<<"sum is "<< k<< endl;
}