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
Answered by
1
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)
Similar questions