Write a function BatsmanAvg which calculate the average of a-02319

Online Quiz This subjective question is related to the book/course vu mth718 Topics in Numerical Methods. It can also be found in vu mth718 Mid Term Solved Past Paper No. 4.

Question 1: Write a function BatsmanAvg which calculate the average of a player (Batsman), Call this function in main program (Function). Take the input of Total Runs made and Total number of matches played from the user in main function
Answer:
#include <iostream.h> // allows program to output data to the screen
// function main begins program execution
int BatsmanAvg(int TotalRuns, int TotalMatches) ;
main() {
int stopit;
int TotalRuns, TotalMatchesPlayed =0;
cout << "Please Entere the total Runs made : " ;
cin>> TotalRuns ;
cout << "Please Entere the total match played : " ;
cin>> TotalMatchesPlayed ;
cout << " Avg Runs = " << BatsmanAvg(TotalRuns,TotalMatchesPlayed);
cin>> stopit; //pause screen to show output
}
int BatsmanAvg(int TotalRuns, int TotalMatches) {
return TotalRuns/TotalMatches;
}

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background