C Program To Accept Annual Salary And Print Tax

C program to accept annual salary of an employee and print the tax

In this C program, we are going to read yearly salary of an employee and calculate taxes on given conditions.

Conditions to calculate the tax are:
  • If salary is less than 1,50,000 tax will be 0.
  • If salary is greater than 1,50,000 and less than or equal to 3,00,000 tax will be 20%.
  • If salary is greater than 3,00,000 tax will be 30%.
/* Aim: To accept annual salary and print the tax */

#include <stdio.h>
void main()
{
	int sal;
	float Tax;

	printf("\n Enter Your Salary number:");
	scanf("%d",&sal);

	if (sal<150000)
		Tax=0;
	else 	{
		if (sal==300000 || sal<300000)
		Tax=sal*0.2;
		else
		Tax=sal*0.3;
		}
  
	printf("\n The salary is %d ",sal);
	printf("\n \n The applicable tax is %f \n \n",Tax);
	return 0;
}

Output:

 Enter Your Salary number:300000

 The salary is 300000 
 
 The applicable tax is 60000.000000