// CALCULATOR #include // return_type function_name(input_type,input_type,.......); declaring function/function prototype float add(float , float ); float sub(float , float ); float multiply(float , float ); float divide(float ,float ); int main() { float num1,num2; int choice,loop; printf ("\n Enter 1:Add 2:Subtract 3:Multiply 4:Divide 5:Exit "); while(loop=1) { scanf("%d ", &choice); if(choice==1) { puts("Enter The Two Number "); scanf("%f",&num1); scanf("%f",&num2); printf( "%f + %f =%f ",num1,num2,add(num1,num2) ); } if(choice==2) { puts("Enter The Two Number "); scanf("%f ",&num1); scanf("%f",&num2); printf( "%f - %f =%f ",num1,num2,sub(num1,num2) ); } if(choice==3) { puts("Enter The Two Number "); scanf("%f",&num1); scanf("%f",&num2); printf( "%f x %f =%f ",num1,num2,multiply(num1,num2) ); } if(choice==4) { puts("Enter The Two Number "); scanf("%f",&num1); scanf("%f",&num2); printf( "%f / %f =%f ",num1,num2,divide(num1,num2) ); } if(choice==5){ loop=0; break;} } } float add(float num1,float num2)// as num 1 and num2 are not global variable /*if you want you can give any name to the two number here not necessary to give same name used when calling variable just check the next line */ {return num1+num2;} float sub(float a,float b) { return a-b; } float multiply(float num1,float num2) { return num1*num2; } float divide (float num1 , float num2) { return num1/num2; }