Hello coders, today we are going to solve Total Expenses CodeChef Solution whose Problem Code is FLOW009.
Task
While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.
If the quantity and price per item are input, write a program to calculate the total expenses.
Input
The first line contains an integer T, total number of test cases. Then follow T lines, each line contains integers quantity and price.
Output
For each test case, output the total expenses while purchasing items, in a new line.
Constraints
- 1 <= T <= 1000
- 1 <= quantity, price <= 100000
Example
Input
3 100 120 10 20 1200 20
Output
12000.000000 200.000000 21600.000000
Solution - Total Expenses - CodeChef Solution
Python 3
#Solution Provided by Sloth Coders for i in range(int(input())): total = 0 m, n = map(int, input().split()) total += (m * n) if m > 1000: discount = total - (total * 10/100) print(discount) else: print(total)
Disclaimer: The above Problem (Total Expenses) is generated by CodeChef but the Solution is provided by Sloth Coders. This Solution is only for Educational purpose.
A Sloth Who loves to Code
Also Read: