C program calculate and display the average of a player
#include <stdio.h>
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.