This is to calculate an employees tax and pension.
The salary is input from the keyboard.
The NI contribution is calculated as 6% of the gross salary.
The pension contribution is calculated as 2% of the gross salary.
The income tax is computed progressively after detracting NI and pension contributions. The taxable amount (after detractions) is divided into bands, each taxed at a different rate as follows:
Gross yearly income: Tax rate:
0 - 4000 0% on first 4000
4001 – 15000 17% on next 10999
15001 – 30000 25% on next 14999
30001 and above 40% on any remainder
can someone check this, this is my first attempt at this program, and its came straight from paper. Thanks for your help.
The salary is input from the keyboard.
The NI contribution is calculated as 6% of the gross salary.
The pension contribution is calculated as 2% of the gross salary.
The income tax is computed progressively after detracting NI and pension contributions. The taxable amount (after detractions) is divided into bands, each taxed at a different rate as follows:
Gross yearly income: Tax rate:
0 - 4000 0% on first 4000
4001 – 15000 17% on next 10999
15001 – 30000 25% on next 14999
30001 and above 40% on any remainder
can someone check this, this is my first attempt at this program, and its came straight from paper. Thanks for your help.
Code:
#include <stdio.h> #include <math.h> int main (void) { int salary, NI, pension, part1, part2, part3, part3, part4, part5, part6; int part7, part8, part9, part10, part11, part12, part13, part14, part15; printf(''enter your yearly salary''); scanf(''%d'',&salary); NI= (salary/100)*6; pension=(salary/)*2; If (salary<4000); { then printf(''your yearly salary is'', salary); printf(''your yearly tax is'', NI); printf(''your yearly pension is'',pension); } If (4001<salary<15000); { part1= salary-4000; part2= (part1/)*17; part3=NI + part2; then printf(''your salary is'', salary); printf(''your yearly tax is'', part3); printf(''your yearly pension is'', pension); } If (15001salary30000); { part4= salary-4000; part5= part4-11000; part6= (part4/100)*17; part7= (part5/100)*25; part8= NI+ part6+ part7; then printf(''your salary is'', salary); printf(''your yearly tax is'', part8); printf(your yearly pension is'', pension); } else (salary>30001); { part9= salary-4000; part10= part9-11000; part11= part10- 15000; part12= (part9/100)*17; part13=(part10/100)*25; part14=(part11/100)*40; part15= NI+ part12+ part13+ part14; then printf(''your salary is'', salary); printf(''your yearly tax is'', part15); printf(''your yearly pension is'', pension); } }
Comment