Dsa
Math
Medium
Calculate the Total Earning from Discounts
You are tasked with calculating the total earnings of a shop after applying discounts on sales. Given a list of items sold and their respective prices, as well as a discount rate, calculate the total earnings after applying the discount on the total price of sold items.
Input format:
- The first line contains an integer N, the number of items sold.
- The second line contains N space-separated integers representing the prices of each item sold.
- The third line contains a floating-point number representing the discount rate in percentage (for example, 10 for 10%).
Output format:
- A single floating-point number representing the total earnings after applying the discount, rounded to two decimal places.
Example:
Input:
3
50 20 30
10
Output:
90.00
Key concepts
matharithmeticstring parsing
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now