2. Write a program to input the Selling Price and Cost Price of a commodity and find the Profit or Loss
made upon selling the product.
For example,
INPUT:
Enter the Selling Price of the commodity: 456
Enter the Cost Price of the commodity: 400
OUTPUT: Profit: 56
INPUT:
Enter the Selling Price of the commodity: 300
Enter the Cost Price of the commodity: 310
OUTPUT: Loss: 10
Answers
Answered by
0
Explanation:
sell = input("Enter the Selling Price of the commodity: ")
cost = input("Enter the Cost Price of the commodity: ")
selling_price = int(sell)
cost_price = int(cost)
diff = selling_price - cost_price
if(diff<0):
print("Loss:",diff)
else:
print("Profit:", diff)
result:
INPUT:
Enter the Selling Price of the commodity: 456
Enter the Cost Price of the commodity: 400
OUTPUT: Profit: 56
Similar questions
Psychology,
2 months ago
English,
2 months ago
Accountancy,
2 months ago
English,
4 months ago
Math,
4 months ago
CBSE BOARD X,
9 months ago
French,
9 months ago