Computer Science, asked by narendraknj9651, 4 months ago

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 BlenderForever
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