Computer Science, asked by Rangsinasarpo685, 4 months ago

To calculate profit loss for given cost sell price in python program

Answers

Answered by valeriy69
4

\small\mathsf\color{pink}{Solution\: using\: python\: 3}

cp = float(input("cp: "))

sp = float(input("sp: "))

if sp > cp:

profit = sp - cp

profit_percent = (profit / cp) * 100

print(f"profit: {profit}\nprofit%: {profit_percent:.2f}")

else:

loss = cp - sp

loss_percent = (loss /cp) * 100

print(f"loss: {loss}\nloss%: {loss_percent:.2f}")

\small\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions