by Dinesh Thakur Category: Control Structures

1. if income is less thn, 1,50,000 then no tax
2. if taxable income is in the range 1,50,001-300,000 then charge 10% tax
3. if taxable income is in the range 3,00,001-500,000 then charge 20% tax
4. if taxable income is above 5,00,001 then charge 30% tax.

#include <Stdio.h>

#include <conio.h>
#define MIN_INCOME1 150001
#define MAX_INCOME1 300000
#define TAX_RATE1 0.10
#define MIN_INCOME2 300001
#define MAX_INCOME2 500000
#define TAX_RATE2 0.20
#define MIN_INCOME3 500001
#define TAX_RATE3 0.30
main()
{
   double income, taxable_income,tax;
   clrscr ();
   printf("\n Enter the income: ");
   scanf ("%lf", &income) ;
   taxable_income = income - 150000;
   if(taxable_income <= 0)
     {
        printf ("\n NO TAX");
     }
   else if(taxable_income >= MIN_INCOME1 && taxable_income < MAX_INCOME1)
     {
        tax = (taxable_income - MIN_INCOME1) *TAX_RATE1;
     }
   else if(taxable_income >= MIN_INCOME2 && taxable_income < MAX_INCOME2)
    {
        tax = (taxable_income - MIN_INCOME2) * TAX_RATE2;
    }
   else
    {
        tax = (taxable_income - MIN_INCOME3) * TAX_RATE3;
        printf("\n TAX= %lf", tax);
    }
       getch();
       return 0;
}

calculate tax

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content







Popular Article