How can I combine all functions (like add,sub,mul.,divide, ect.)... To make a perfect calculator..... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I combine all functions (like add,sub,mul.,divide, ect.)... To make a perfect calculator.....

How to do multiple cammands in a single programme? as the computer (in code playground) asks input only once.

12th Apr 2019, 5:19 PM
Ravi Mishra
Ravi Mishra - avatar
3 Answers
+ 4
You can read input once for two values, just make several variables each used for storing different type of operation. Or, use a loop to get the program to keep reading input, while the operation was supported, prepare some error handling scheme where the loop should stop, for example, if one of the operands or the operator was invalid. Just giving you an idea. Good luck 👍
12th Apr 2019, 6:42 PM
Ipang
+ 3
You're welcome Rk Mishra Best of luck 👍
13th Apr 2019, 6:13 AM
Ipang
+ 2
Ipang thanx for idea
13th Apr 2019, 3:40 AM
Ravi Mishra
Ravi Mishra - avatar