Write a program to input basic salary of an employee and calculate its Gross salary in python:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Where HRA : House Rent Allowance , DA : Dearness Allowance
Answers
Answered by
28
Answer:
Gross salary is the final salary computed after the additions of DA, HRA and other allowances. The formula for DA and HRA is
da = basic_salary * (DA/100)
If DA = 80% then the statement becomes da = basic_salary * (80/100). Which can also be written as DA = basic_salary * 0.08. Likewise you can also derive a formula for HRA.
Step by step descriptive logic to find gross salary of an employee.
Input basic salary of employee. Store it in some variable say basic_salary.
If basic_salary <= 10000 then, hra = basic_salary * 0.8 and da = basic_salary * 0.2.
Similarly check basic salary and compute hra and da accordingly.
Calculate final gross salary using formula gross_salary = basic_salary + da + hra
Similar questions