2.
Write a python program to input the basic salary of an employee and calculate
its Gross salary according to the following:
(DA or dearness allowance is calculated as a specific percentage of the basic
salary
which is then added to the basic salary along with other components like HRA (House
Rent Allowance)
to make up the total salary of an employee of the government sector.)
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Ans:
Basic_Salary = int(input("Enter the basic salary : Rs."))
if Basic_Salary <= 10000 :
HRA = (20/100)*Basic_Salary
DA = (80/100)*Basic_Salary
elif Basic_Salary <= 20000 :
HRA = (25/100)*Basic_Salary
DA = (90/100)*Basic_Salary
elif Basic_Salary > 20000 :
HRA = (30/100)*Basic_Salary
DA = (95/100)*Basic_Salary
Gross_Salary = Basic_Salary + HRA + DA
print ("Dearness Allowance of Basic Salary :" , DA)
print ("House Rent of Basic Salary :" , HRA)
print ("Gross Salary :" , Gross_Salary)