#include #include float cal(float x1,float y1,char op1); // prototype for function cal int main() { float x,y,result; char op; printf("\n enter the values and operator\n"); scanf("%f %f %c",&x,&y,&op); if(op=='+' || op=='-' || op=='*' || op=='/' || op=='^') { result=cal(x,y,op); // function call to cal printf("%f %c %f is %f",x,op,y,result); } else printf("\n error"); return 0; } // defining function for cal float cal(float x1,float y1,char op1) { float result1; switch(op1) { case '+' : result1=x1+y1; break; case '-' : result1=x1-y1; break; case '*' : result1=x1*y1; break; case '/' : result1=x1/y1; break; case '^' : result1=pow(x1,y1); break; } return result1; }