Question #212590

Use a function called double detAverege() to determine the average percentage. The function will receive 3 integer parameters. The 3rd mark will be passed by reference.


Expert's answer

/******************************************************************************
Use a function called double detAverege() to determine the average percentage. 
The function will receive 3 integer parameters. The 3rd mark will be passed by reference.


*******************************************************************************/


#include <iostream>


using namespace std;


double detAverege(int a, int b, int &c){
    int sum=a+b+c;
    double avg=sum/3.0;
    return avg;
}
int main()
{
    int x=67;
    int y=34;
    int z=78;
    cout<<"Average percentage: "<<detAverege(x,y,z);


    return 0;
}

LATEST TUTORIALS
APPROVED BY CLIENTS