Objective

Extend the Addition Calculator exercise to add any two numbers; not just two integers.

Difficulty

Very easy

Description

Back in the exercise Addition Calculator, we created a program that took as input two integers and then printed out their sum.

Recall that the entered values were converted into integers using int(). This meant that floating-point numbers couldn't be entered — they would've otherwise lead to an error.

Now, in this exercise, your task is to rewrite that simple program such that it accepts any two numbers; not just integers.

Furthermore, after performing the addition, if the result is an integer (whose fractional part is zero), output the result as an integer.

Shown below are two examples:

x: 5 y: 2.5 The sum is: 7.5

Here, since the sum 7.5 is not an integer, it is output as it is.

x: 1.5 y: 2.5 The sum is: 4

However, here the sum 4.0 is indeed an integer, and is likewise output as an integer — 4.