Thursday 24 February 2022

C Program To Calculate Income Tax (sample)

 TAX CALCULATOR

( SAMPLE )

Code :

#include<stdio.h>

int main()
{
    float income, tax = 0;
   
    printf("Enter your annual income: ");
    scanf("%f", &income);
   
    if(income <= 250000)
    {
        printf("\nYou didn't have to pay tax.");
        return 0;
    }
    else if(income > 250000 && income <= 500000)
    {
        tax = income * 0.05;
    }
    else if(income > 500000 && income <= 1000000)
    {
        tax = 25000 + ((income - 500000) * 0.20);
    }
    else if(income > 1000000)
    {
        tax = 125000 + ((income - 1000000) * 0.30);
    }
   
    printf("\nYour Income Tax to be paid is %.4f Rupees.\n", tax);
    return 0;
}

Come again Learn again !

< iCodeBuzz />


No comments:

Post a Comment