Help me solve this problem!

Правка en1, от pjcode0, 2023-03-30 22:40:18

Write a program to input gross amount of bill and calculate the net amount according to the below discounts:

If amount <= 1000, then discount is 0% If amount is from 1001 to 5000, then discount is 5% If amount is from 5001 to 10000, then discount is 10% If amount > 10000, then discount is 15% An additional discount of 2% if bill is greater than 30000.

input : 2500 output: 2375.00 can anyone help . i know it is a simple program but i am not getting it idk why i have tries net amount = gross_amount divided by 1.05 (if gross amount from 1001 to 5000) , similarly gross_amount divided by 1.07 if it is from 5001 to 10000, .... but it is giving wrong result.

Some other test cases:

input: 500 output: 500.0

input: 25000 output: 21250.0

input: 5500 output: 4950.0

input: 12000 output: 10200.0

input: 40000 output: 33200.0

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский pjcode0 2023-03-30 22:40:18 889 Initial revision (published)