Ask Question

Write afunction BalerAvg which calculate and display the average of aplayer (Baler), call this

function in mainprogram (function). Take input of runs given and ball deliveredfrom the user in

mainfunciton.

The average may becalculated by the formula,

Average = (Total Runs given * 60) / (Total number of ballsdelivered);

+2
Answers (1)
  1. 22 January, 07:01
    0
    C program calculate and display the average of a player

    #include

    void BalerAvg (int runs, int balls) / /Defining function

    {

    double Avg=0.0;

    Avg = (double) (runs * 60) / (balls); //formula is given in question

    printf ("Average is%f", Avg); //printing the average

    }

    int main () / /driver function

    {

    int runs=0, balls=0;

    printf ("Enter runs given by the baler in an over/n"); //taking input from user

    scanf ("%d",&runs);

    printf ("Enter the number of balls dilivered by the baler/n");

    scanf ("%d",&balls);

    BalerAvg (runs, balls); //Calling Function

    return 0;

    }

    Output

    Enter runs given by the baler in an over

    5

    Enter the number of balls dilivered by the baler

    69

    Average is 4.347826

    Function BalerAvg which calculate and display the average of a player (Baler)

    void BalerAvg (int runs, int balls) / /Defining function

    {

    double Avg=0.0;

    Avg = (double) (runs * 60) / (balls); //formula is given in question

    printf ("Average is%f", Avg); //printing the average

    }

    This is the function with the name BalerAvg of return type void having parameters runs and balls of integer type. This function is used to calculate the average of a player.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write afunction BalerAvg which calculate and display the average of aplayer (Baler), call this function in mainprogram (function). Take ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers