Profit or Loss
The amount at which a product is sold by the seller is known as the Selling Price. The amount at which the seller has acquired the product is known as the Cost Price.
If the Selling Price of a product is higher than its cost price, then the seller has made a profit. If it is lesser, then the seller has incurred loss selling that product. If the Selling Price is equal to the Cost Price, it means the seller has made No Profit and No loss, by selling the product.
Given Cost price
The first line is an integer
In the given example,
CP = 143,SP = 155, So as the selling price is higher than the cost price, the output should be Profit.
Sample Input 1
143
155
Sample Output 1
Profit
Sample Input 2
165
125
Sample Output 2
Loss
Solution.
cp = int(input())
sp = int(input())
if sp>cp:
print('Profit')
elif sp<cp:
print('Loss')
elif sp==cp:
print('No profit')
Answer:
cp = int(input())
sp = int(input())
if sp>cp:
print('Profit')
elif sp<cp:
print('Loss')
elif sp==cp:
print('No profit')
Comments
Leave a comment