C program to calculate tax of employee, given the following conditions - IProgramX

Q. Write a program which accept annual basic salary of an employee and calculates and displays the Income tax as per the following rules
Rule:
Basic < 1,50,000                     Tax = 0
           1,50,000 to 3,00,000    Tax = 20%
         > 3,00,000                      Tax = 30%



Program 

#include<stdio.h>
#include<math.h>
#include<conio.h>
void main()
{
float salary,tax;
printf("enter the emp basic salary :");
scanf("%f",&salary);
if(salary<=150000)
{
tax=0;
printf("tax = %f",tax);
}
else if(salary>150000 && salary<=300000)
{
tax=(salary*0.2);
printf("tax = %f",tax);
}
else if(salary>300000)
{
tax=(salary*0.3);
printf("tax = %f",tax);
}
}

Output:

enter the emp basic salary :254000
tax = 50800.000000

Post a Comment

1 Comments