Write a program that inputs two numbers and an operator in main function and passes them to a function. The function applies arithmetic operation on two number on the basis of the operator entered by user using switch statement.
Answers
Answered by
3
Answer:
public int op(int a , int b , String op){
int cal =0;
switch(op){
case "+":
return a+b;
break;
case value "-":
return a-b;
break;
case value "*":
return a*b;
break;
case value "/":
return a/b;
}
}
Explanation:
call this method from main function
Similar questions