Home » C programs

C program to read the yearly salary of an employee and find tax based on the given conditions



In this C program, we are going to read yearly salary of an employee and calculate taxes on given conditions. Tax percentages have different values based on different salary slots.
Submitted by IncludeHelp, on March 06, 2018

Given yearly salary and tax percentages and we have to calculate tax based on given salary and tax percentages using C program.

Conditions to calculate tax, if salary is:

  • Less than or equal to 4,00,000 – Tax will be 1%
  • Greater than 4,00,000 and Less than 10,00,000 – Tax will be 1% for 4,00,000 amount and 15% on remaining amount
  • Greater than 10, 00, 000 – Tax will be 1% for 4, 00, 000, 15% for next 6, 00, 000 and 25% on remaining amount.

Program to calculate tax of yearly salary based on given conditions in C

#include <stdio.h>

int main()
{
	long int salary; //to store salary
	float tax; //to store tax
	
	//input salary
	printf("Enter yearly salary: ");
	scanf("%ld",&salary);
	
	tax =0;

	//tax calculations
	if(salary<=400000)
		tax = salary*1/100;
	else if(salary>400000 && salary<=1000000){
		tax = 400000*1/100;
		tax = tax + (salary-400000)*15/100;
	}
	else{
		tax = 400000*1/100;
		tax = tax + (600000)*15/100;
		tax = tax + (salary-1000000)*25/100;		
	}
	
	printf("Salary: %ld\n",salary);
	printf("Tax: %0.2f\n",tax);
	
	return 0;	
}

Output

Run (1)
Enter yearly salary: 300000
Salary: 300000
Tax: 3000.00

Run (2)
Enter yearly salary: 400000
Salary: 400000
Tax: 4000.00

Run (3)
Enter yearly salary: 500000
Salary: 500000
Tax: 19000.00

Run (4)
Enter yearly salary: 600000
Salary: 600000
Tax: 34000.00

Run (5)
Enter yearly salary: 1000000
Salary: 1000000
Tax: 94000.00

Run (6)
Enter yearly salary: 1100000
Salary: 1100000
Tax: 119000.00





Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.



Comments and Discussions





© https://www.includehelp.com (2015-2018), Some rights reserved.




close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.