Write a program in Python to read salary from the user and if it is greater than equal to 30000 then
bonus is calculated as 10% of the salary, else if it is greater than equal to 20000 then bonus is calculated
as 20% of the salary, else if it is greater than equal to 10000 then bonus is calculated as 30% of the
salary, else bonus is calculated as 40% of the salary.
Answers
Answered by
30
Language:
Python
Program:
a=int(input("Enter your salary: "))
if a>=30000:
b=a*0.1
print("Bonus:", b)
elif a>=20000:
b=a*0.2
print("Bonus:", b)
elif a>=10000:
b=a*0.3
print("Bonus:", b)
else:
b=a*0.4
print("Bonus:", b)
Output:
Enter your salary: 4000
Bonus: 1600.0
Explanation:
- If - elif-else statements checks the condition and display the output as per condition.
Attachments:
Attachments:
Answered by
8
Answer:
Language:
Python
Program:
a=int(input("Enter your salary: "))
if a>=30000:
b=a*0.1
print("Bonus:", b)
elif a>=20000:
b=a*0.2
print("Bonus:", b)
elif a>=10000:
b=a*0.3
print("Bonus:", b)
else:
b=a*0.4
print("Bonus:", b)
Output:
Enter your salary: 4000
Bonus:
1600.0
Explanation:
- If - elif-else statements checks the condition and display the output as per condition.
Attachments:
Attachments:
Similar questions