Computer Science, asked by piyushagarwal1153, 6 months ago

How can you pass value to a calc function?
plss ans me fast​

Answers

Answered by Anonymous
4

Answer:

I am building a simple calculator as homework. The function takes two numbers (number1, number2) and an operator (+, -, *, /) as argument.

However there are several scenarios:

If the operator is missing --> return "wrong data provided"

If not, then calculate normally

If number 2 is missing --> assume number "0" for + & - calculation and "1" for * & / calculation

Similar questions