Rita found that the project includes most of the calculator built-in functions like addition, subtraction, multiplication, division, modulo, power, and average. So she consolidated everything as Calculator module and hands over this module to Priya.
Rita instructed Priya to implement this module as a menu driven program. She listed out the order of menu.Help Priya to write a program to implement a menu driven calculator.
Function Specification:int addition(int a, int b)int subtraction(int a, int b)int multiplication(int a, int b)float division(int a, int b)int modulo(int a, int b)float average(int a, int b)int power(int a, int b)
The choice of operations are as follows:1 – addition2 – subtraction3 – multiplication4 – division5 – modulus6 – average7 - power
Input Format:Input consists of 3 integers. The first 2 integers correspond to the operands and the third integer corresponds to the choice of operation.Output Format:The output consists of a single integer or floating point number based on the choice of operation. All floating point numbers are displayed with respect to 2 decimal places.Refer sample input and output for formatting details.
Sample Input 1:23221Sample Output1:45
Sample Input 2:2323Sample Output2:46

Program Code:#includeint addition (int a,int b){    return(a+b);}int subtraction (int a,int b) {    return(a-b);}int multiplication (int a,int b) {    return(a*b);}float division (int a,int b) {    float k;    k= (float)a/b;    return(k);}int modulo(int a,int b) {    return(a%b);}int power(int a,int b) {    int i,power=1;    for(i=1; i<=b; i++)    {        power = power * a;    }    return power; }float average(int a,int b) {    float k=a+b;    return (k/2);}
int main(){int a,b,ch;scanf("%d%d%d",&a,&b,&ch);switch(ch){    case 1:    printf("%d",addition(a,b));    break;        case 2:    printf("%d",subtraction(a,b));    break;        case 3:    printf("%d",multiplication(a,b));    break;        case 4:    printf("%.2f",division(a,b));    break;        case 5:    printf("%d",modulo(a,b));    break;        case 6:    printf("%.2f",average(a,b));    break;
    case 7:    printf("%d",power(a,b));    break;  }return 0;}