Friday, 18 February 2022

calculate income tax in C

 #include <stdio.h>


int main()
{
    float income, tax = 0;
    printf("Enter your income\n");
    scanf("%f", &income);
    if (income >= 250000 && income <= 500000)
    {
        tax = tax + 0.05 * (income - 250000);
    }

    if (income >= 500000 && income <= 1000000)
    {
        tax = tax + 0.2 * (income - 500000);
    }

    if (income >= 1000000 )
    {
        tax = tax + 0.3 * (income - 500000);
    }
    printf("Total tax you have to pay is:%f", tax);
    return 0;
}

No comments:

Post a Comment