Q2: A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount.
Answers
CODE:
python 3:
--------------------------------------------------------------------------------------------------------------
salary = eval(input("Enter your salary:"))
service_yrs = eval(input("Enter Years of service:"))
if service_yrs > 5:
print("Yours salary(+Bonus) = ",salary + (salary)*5/100)
else:
print("You are not eligible for bonus as you have less service years.")
-----------------------------------------------------------------------------------------------------------------
NOTE:
pls correct indentation errors
PLS MARK AS BRAINLIEST IF YOU ARE SATISFIED ; )
The program in python for the given problem is,
salary = int(input("Enter your salary = "))
year = int(input("Enter your year of service = "))
if year>5:
print("Your Net bonus is",0.05*salary)
- The program above is only for calculating the Net bonus amount of an employee.
- In the first two lines, the input is being taken from the user for the salary and the number of years he has been working for.
- Then the if condition is checked for the number of working years to be more than 5 or not.
- Finally, the output statement is printed if the condition becomes true.