Basic Salary Calculation in Python


Ramesh's basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

This program calculates the gross salary of an individual based on their basic salary. The program starts by prompting the user to enter their basic salary. Then, the program calculates the dearness allowance (DA) by multiplying the basic salary with 0.4. Similarly, the program calculates the house rent allowance (HRA) by multiplying the basic salary with 0.2. After calculating the DA and HRA, the program adds the basic salary, DA and HRA to get the gross salary. Finally, the program prints the calculated gross salary.


Source Code

basic_salary=int(input("Enter the basic salary:"))
da=0.4*basic_salary;
hra=0.2*basic_salary;
gross_salary=basic_salary+da+hra;
print("Gross Salary = ",gross_salary)

Output

Enter the basic salary:15000
Gross Salary =  24000.0


Example Programs