This Python program calculates an employee’s salary based on:
- Hourly wage
- Number of hours worked
It then deducts 10% as tax and displays both the gross and net salary.
# Read inputs from user
hourly_rate = float(input("Enter hourly wage: "))
hours_worked = float(input("Enter number of hours worked: "))
# Calculate gross salary
gross_salary = hourly_rate * hours_worked
# Calculate tax (10%)
tax = gross_salary * 0.10
# Calculate net salary
net_salary = gross_salary - tax
# Display results
print("\n--- Salary Details ---")
print(f"Gross Salary: {gross_salary:.2f}")
print(f"Tax Deducted (10%): {tax:.2f}")
print(f"Net Salary: {net_salary:.2f}")
Enter hourly wage: 20
Enter number of hours worked: 40
--- Salary Details ---
Gross Salary: 800.00
Tax Deducted (10%): 80.00
Net Salary: 720.00
- The user enters hourly wage and total hours worked
- Gross salary is calculated by multiplying rate × hours
- A 10% tax is deducted from the gross salary
- The net salary is displayed with two decimal places