Read n values (each is int or float with dot). If all are integers, output PRODUCT as integer. Otherwise output SUM as float with 2 decimals.
• First line: Integer n
• Second line: n space-separated values
• Each value is either an integer
• Or a float (contains a dot .)
• If all values are integers → print the PRODUCT as an integer
•Otherwise → print the SUM as float with exactly 2 decimal places
• 1 ≤ n ≤ 10^5
• -10^9 ≤ value ≤ 10^9
• Values are valid integers or floats
Explanation 1
All values are integers.
Product = 2 × 3 × 4 = 24
So output is 24.
Explanation 2
Since one value (3.5) is a float,
we compute SUM instead.
Sum = 2 + 3.5 + 4 = 9.5
Print with 2 decimals → 9.50
1.Read integer n.
2.Read list of n values as strings.
3.Check if all values do not contain a dot .:
• If true:
• Convert all to integers.
• Multiply them together.
• Print product.
4.Otherwise:
• Convert all values to float.
• Compute sum.
• Print sum formatted to exactly 2 decimal places.