Discount Calculation
Given an item's price in paise and a whole-number discount percentage, return the final payable amount in paise. Calculate the exact percentage and round once…
Given an item's price in paise and a whole-number discount percentage, return the final payable amount in paise. Calculate the exact percentage and round once to the nearest paise. A half-paise tie rounds upward. For example, a price of 101 paise with a 50% discount has an exact payable amount of 50.5 paise, so return 51.
- 0 ≤ price_paise ≤ 2,147,483,647 - 0 ≤ discount_percent ≤ 100 - Both inputs are integers; booleans, strings, and fractional values are invalid. - Return the payable price as an integer count of paise.
Example 1: input price_paise = 10000, discount_percent = 25; output 7500. The payable share is 75%, so the final amount is 7,500 paise.
Example 2: input price_paise = 101, discount_percent = 50; output 51. The exact payable amount is 50.5 paise, which rounds upward.
Example 3: input price_paise = 100, discount_percent = 100; output 0. A full discount leaves zero paise to pay.
Category: Math & Numbers. Topic: math. Difficulty: Easy. Patterns: math.