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