Write a python program to input basic salary of an employee and
calculate its Gross salary according to following:
If Basic Salary <= 15000, then HRA = 25% of Basic Salary, DA = 80%
of Basic Salary
If Basic Salary <= 25000, then HRA = 30% of Basic Salary, DA = 90%
of Basic Salary
If Basic Salary > 25000, then HRA = 35% of Basic Salary, DA = 95%
of Basic Salary
Gross Salary = Basic Salary + HRA + DA
Also show the output.
Answers
Answer:
basic_salary = int(input("Enter your basic salary: "))
if basic_salary > 25000:
hra = .35 * basic_salary
da = .95 * basic_salary
elif basic_salary > 15000:
hra = .30 * basic_salary
da = .90 * basic_salary
else:
hra = .25 * basic_salary
da = .80 * basic_salary
gross_salary = basic_salary + hra + da
print(f"The gross salary is {gross_salary}.")
Answer:
a = int(input("enter your basic salary"))
d = "your HRA is "
h = "your DA is"
s = a*0.2
f = a*0.8
e = a*0.25
q = a*0.9
v = a*0.3
n = a*0.95
if a<=10000:
print(f"{d} {s}")
print(f"{h} {f}")
print('your gross salary is ', a+s+f )
elif a<=20000:
print(f"{d} {e}")
print(f"{h} {q}")
print("your gross salary is", a+q+e)
elif a>20000:
print(f"{d} {v}")
print(f"{h} {n}")
print("your gross salary is", a+v+n)
print("end")
Hope You like it ☺️