#include int main () { char name[30]; float tax, income, allowance, net_chargeable; int marital, children, parent; int more = 1; // Boolean do{ printf("Name? "); scanf("%s" , name); do { printf("Total annual income? "); scanf("%f", &income); } while (income <0); do { printf("Marital status (1=Single, 2=Married)? "); scanf("%d", &marital); }while (marital != 1 && marital !=2); if (marital == 2) do { printf("Number of children? "); scanf("%d", &children); } while (children < 0); do{ printf("Number of dependent parents? "); scanf("%d", &parent); }while (parent < 0); allowance = 30000; if (marital == 2) { allowance = allowance + 30000; if (children <= 5) allowance = allowance + children * 10000; else allowance = allowance + 50000; } allowance = allowance + parent * 15000; net_chargeable = income - allowance; if (net_chargeable <= 0) tax = 0; else if (net_chargeable <= 20000) tax = net_chargeable * 0.1; else if (net_chargeable <=40000) tax= net_chargeable *0.2; else { tax= 20000 * 0.1 + 20000 * 0.2; tax= tax + (net_chargeable - 40000) * 0.3; } if ( tax > income * 0.25) tax = income * 0.25; printf("Tax for %s is $%.0f\n\n", name); do{ printf("Any more (yes=1/no=0)? "); scanf("%d", &more); } while (more != 1 && more ==0); printf("\n"); }while (more == 1); return 0; }