You are on page 1of 1

1: #include <iostream>

2:
3: using namespace std ;
4:
5: int main ()
6: {
7: float price ,discount ,total ;
8: cout << "Enter your amount price : RM " ;
9: cin >> price ;
10:
11:
12: if ( price >= 1001 && price <= 3000)
13: {
14: discount = 0.055;
15: total = price - (price*discount) ;
16: cout << "Payment after discount = RM" << total << endl ;
17: }
18:
19: else if ( price >= 501 && price <= 1000.99)
20: {
21: discount = 0.035;
22: total = price - (price*discount) ;
23: cout << "Payment after discount = RM" << total << endl ;
24: }
25:
26: else if ( price >= 101 && price <= 500.99)
27: {
28: discount = 0.025;
29: total = price - (price*discount) ;
30: cout << "Payment after discount = RM" << total << endl ;
31: }
32:
33: else if ( price >= 50 && price <= 100.99)
34: {
35: discount = 0.01;
36: total = price - (price*discount) ;
37: cout << "Payment after discount = RM" << total << endl ;
38: }
39:
40: else if ( price >= 0 && price <= 49.99)
41: {
42: discount = 0.0;
43: total = price - (price*discount) ;
44: cout << "Payment after discount = RM" << total << endl ;
45: }
46:
47: }

You might also like