Site icon codemaniacstudio

Write a Python program to calculate profit or loss.

Write a Python program to calculate profit or loss.

SOLUTION....

# Program to calculate Profit or Loss

# Input
cp = float(input("Enter Cost Price: "))
sp = float(input("Enter Selling Price: "))

# Check Profit or Loss
if sp > cp:
    profit = sp - cp
    print("Profit = ",profit)
elif cp > sp:
    loss = cp - sp
    print("Loss = ",loss)
else:
    print("No Profit No Loss")

OUTPUT

Exit mobile version