-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCode Chef Tax Slab Problem
51 lines (43 loc) · 1.06 KB
/
Code Chef Tax Slab Problem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
using namespace std;
int main()
{
int T;
long long i, N, net, tax;
cin >> T;
for(i=1;i<=T;i++)
{
cin >> N;
tax = 0;
if(N<=250000)
{
tax = 0;
}
else if(N>250000 && N<=500000)
{
tax = 0.05*(N-250000);
}
else if(N>500000 && N<=750000)
{
tax = 0.05*250000 + 0.1*(N-500000);
}
else if(N>750000 && N<=1000000)
{
tax = 0.05*250000 + 0.1*250000 + 0.15*(N-750000);
}
else if(N>1000000 && N<=1250000)
{
tax = 0.05*250000 + 0.1*250000 + 0.15*250000 + 0.2*(N-1000000);
}
else if(N>1250000 && N<=1500000)
{
tax = 0.05*250000 + 0.1*250000 + 0.15*250000 + 0.2*250000 + 0.25*(N-1250000);
}
else
{
tax = 0.05*250000 + 0.1*250000 + 0.15*250000 + 0.2*250000 + 0.25*250000 + 0.3*(N-1500000);
}
net = N-tax;
cout << net<<endl;
}
}