Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to create an calculator using 1 line?

0 votes
asked Feb 6, 2020 by carl

2 Answers

+1 vote
answered Feb 6, 2020 by anonymous
cal = op == '+' ? (a + b) : (op == '-' ? (a -b): (op == '*' ? (a*b): ( op == '/' ? (a / b): NAN ) ) );
0 votes
answered Feb 6, 2020 by skinnypuppy1 (140 points)
not sure it can be done in one line
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...