Write a Python program to input basic salary of an employee and calculate its Gross salary according to following:

SOLUTION....

# Program to calculate Gross Salary of an Employee

# Input basic salary
basic = float(input("Enter basic salary of the employee: "))

# Calculate HRA and DA based on conditions
if basic <= 10000:
    hra = basic * 0.20
    da = basic * 0.80
elif basic <= 20000:
    hra = basic * 0.25
    da = basic * 0.90
else:
    hra = basic * 0.30
    da = basic * 0.95

# Gross salary
gross = basic + hra + da

# Output
print("Basic Salary = ",basic)
print("HRA = ",hra)
print("DA = ",da)
print("Gross Salary = ",gross)
				

OUTPUT

Leave a Reply

Your email address will not be published. Required fields are marked *

sign up!

We’ll send you the hottest deals straight to your inbox so you’re always in on the best-kept software secrets.