C language to compile a program for calculating personal income tax, requires the input of the amount of income, can output the amount of personal income tax payable
Compile a program for calculating personal income tax, which requires the input of the amount of income and the ability to generate the payable
Personal income tax. The individual income tax collection method is as follows:
The starting point is the part where 3500 RMB does not exceed 1500 RMB, and the levy is 3%. The amount exceeds 1500 ~ RMB 4500 million, with a levy of RMB 10% million; more than RMB 4500 million ~ RMB 9000 million, with a levy of RMB 20% million; more than RMB 9000 million ~ RMB 350000 million, with a levy of RMB 25% million; more than RMB 35000 million ~ RMB 55000 million; RMB 30% million; more than RMB 55000 million ~ Part of the RMB 80000, with a levy of 35%.
# Include
# Define TAXBASE 3500 // start point typedef struct {// tax collection interval and tax collection rate long start; long end; double taxrate;} TAXTABLE; TAXTABLE TaxTable [] ={{ 0.03 }, {1500,4500, 0.10 },{ 4500,9000, 0.20 },{ 9000,35000, 0.25 },{ 35000,55000, 0.30 },{ 55000,80000, 0.35 },{ 80000, 1e9, 0.45 }}; double CaculateTax (long profit) {int I; double tax = 0.0; profit-= TAXBASE; for (I = 0; I
TaxTable [I]. start) {if (profit> TaxTable [I]. end) {tax + = (TaxTable [I]. end-TaxTable [I]. start) * TaxTable [I]. taxrate;} else {tax + = (profit-TaxTable [I]. start) * TaxTable [I]. taxrate; printf ("Tax scope: % 6ld ~ % 6ld tax amount in this range % 6.2f \ n ", TaxTable [I]. start, TaxTable [I]. end, tax); return tax;} printf ("tax scope: % 6ld ~ % 6ld: % 6.2f \ n ", TaxTable [I]. start, TaxTable [I]. end, tax) ;}}return tax ;}void main () {long profit; double tax; printf ("Enter your personal income amount :"); scanf ("% ld", & profit); tax = CaculateTax (profit); printf ("your personal income tax is: % f \ n", tax );}