Smart Sum
Create a function named sumValues that behaves differently based on the data type:
- If inputs are two integers A and B, return integer sum
- If inputs are two floating-point numbers A and B, return precise decimal sum
Example 1:
Input: A = 3, B = 4
Output: 7
Example 2:
Input: A = 3.5, B = 4.2
Output: 7.70
Now Your Turn!
Pick the correct output for the given inputInput: A = 1.9, B = 5.86
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- -100 <= A, B <= 100