write a Python program to accept the cost price and selling price and find out if it is a gain or loss . also the amount of gain or loss
Answers
Explanation:
actual_cost = float(input(" Please Enter the Actual Product Price: "))
sale_amount = float(input(" Please Enter the Sales Amount: "))
if(actual_cost > sale_amount):
amount = actual_cost - sale_amount
print("Total Loss Amount = {0}".format(amount))
elif(sale_amount > actual_cost):
amount = sale_amount - actual_cost
print("Total Profit = {0}".format(amount))
else:
print("No Profit No Loss!!!")
I guess this should be correct
Question:-
- Write a Python program to accept the cost price and selling price and find out if it is a gain or loss . Also the amount of gain or loss.
Program:-
c=float(input("Enter the cost price: "))
s=float(input("Enter the selling price: "))
if s>c:
g=s-c
print("Profit is: ",g)
pp=g/c*100 #profit % = gain/cp*100%
print("Profit Percentage is: ",pp)
else:
l=c-s
print("Loss is: ",l)
lp=l/c*100
print("Loss Percentage is: ",lp)