Average sales value
A shop has N items. Each item has a name, a price per unit and a quantity sold. Print the average sales value per item, that is (sum of price × quantity) ÷ N, with exactly two decimal places.
Reported in: TCS NQT (26 Apr 2024) (memory-based)
Input
First line: N. Next N lines: name, price and quantity.
Output
The average, with two decimal places.
Constraints
1 ≤ N ≤ 1000; 0 ≤ price ≤ 10^4; 0 ≤ quantity ≤ 10^4.
Example 1
Input:
3
apple 1.0 5
orange 10.0 5
kiwi 10.0 2
Output:
25.00Example 2
Input:
2
pen 12.5 4
book 40 1
Output:
45.00Hint: Add price × quantity for every item, divide by N using floating-point division, and print with two decimals.