Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Simple Calculator Given the numbers N1, N2 and an operation character C. Write a simple calculator which performs the 4 basic mathematical operations (i.e. Addition,
Simple Calculator
Given the numbers N1, N2 and an operation character C.
Write a simple calculator which performs the 4 basic mathematical operations (i.e. Addition, subtraction. Multiplication, and division) according to given character C.
Hint: Use type-casting
Input:
5
10
+
Where:
- First line of input represent number N1
- Second line of input represents number N2]
- Third line represents operation character C.
Output:
15.00
Note
- if C is not a valid operation then display -1.00
- If C is '/' (division) and N2 = 0 (zero) then display -2.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started