5.Write a Python program to input basic salary of an employee and calculate its Gross salary according to following: Basic Salary <= 10000 : HRA = 20%, DA = 80% Basic Salary <= 20000 : HRA = 25%, DA = 90% Basic Salary > 20000 : HRA = 30%, DA = 95%
Static
basic = 22000 if basic <=10000: da = basic * 0.8 hra = basic * 0.2 elif basic <=20000: da = basic * 0.9 hra = basic * 0.25 else: da = basic * 0.95 hra = basic * 0.3 gross = basic + hra + da print(“Gross Salary of Employee is :- “,gross)
Output :-
Dynamic
basic = float(input(“Enter the Basic Salary :- “)) if basic <=10000: da = basic * 0.8 hra = basic * 0.2 elif basic <=20000: da = basic * 0.9 hra = basic * 0.25 else: da = basic * 0.95 hra = basic * 0.3 gross = basic + hra + da print(“Gross Salary of Employee is :- “,gross)