C Program to Calculate Income Tax
#include<stdio.h>
void main()
{
float income,totaltax;
printf("\nEnter the income(in Lakhs) : ");
scanf("%f",&income);
if (income<=3)
totaltax = 0;
else if (income<=6)
totaltax = 0+(income-3)*0.05;
else if (income<= 9)
totaltax = 0.15+(income-6)*0.1;
else if (income <= 12)
totaltax = 0.45+(income-9)*0.15;
else
totaltax =0.9+(income-12)*0.2;
printf(" Total Tax( in Lakhs)= %0.2f",totaltax);
}
OR
#include<stdio.h>
void main()
{
int income; float tax;
printf("Enter the income: ");
scanf("%d", &income);
if (income<=300000)
tax=income*0;
else if(income<=600000) tax=(300000*0)+(income-300000)*0.05;
else if(income<=900000) tax=(300000*0)+(300000*0.05)+(income-600000)*0.1;
else if (income<=1200000) tax=(300000*0)+(300000*0.05)+(300000*0.1)+(income-
900000)*0.15;
else if(income<=1500000)
tax=(300000*0)+(300000*0.05)+(300000*0.1)+(300000*0.15)+(income- 1200000)*0.2;
else if(income<=2000000)
tax=(300000*0)+(300000*0.05)+(300000*0.1)+(300000*0.15)+(300000*0
.2)+(income-1500000)*0.25;
else if (income>2000000)
tax=(300000*0)+(300000*0.05)+(300000*0.1)+(300000*0.15)+(300000*0.2)+(500000*0.25)+(income-2000000)*0.3;
printf("total tax: %2f",tax);
}
Comments
Post a Comment