114k views
0 votes
In one state, single residents are subject to the following income tax: Income Amount of tax Not over $750 1% of income $750--$2,250 $7.50 plus 2% of amount over $750 $2,250--$3,750 $37.50 plus 3% of amount over $2,250 $3,750--$5,250 $82.50 plus 4% of amount over $3,750 $5,250--$7,000 $142.50 plus 5% of amount over $5,250 Over $7,000 $230.00 plus 6% of amount over $7,000 Write a program that asks the user to enter their income and then displays the tax due (in USD)

User Dom Abbott
by
7.3k points

1 Answer

5 votes

Answer:

Step-by-step explanation:

#include <stdio.h>

int main() {

double income, tax;

/* get the income from the user */

printf("Enter your taxable income:");

scanf("%lf", &income);

/* calculate the income tax */

if (income <= 750) {

tax = income * 1/100;

} else if (income >750 && income <=2249) {

tax = 7.50 + (income * 2/100);

} else if (income >=2250 && income <=3749) {

tax = 37.50 + (income * 3/100);

} else if (income >=3750 && income <=5249) {

tax = 82.50 + (income * 4/100);

} else if (income >=5250 && income <=6999) {

tax = 142.50 + (income * 5/100);

}else if (income >=7000) {

tax = 230.00 + (income * 6/100);

}

/* print the result */

printf("tax due is $ %.2lf\\",tax);

return 0;

}

User Shrawan
by
8.2k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories