DevJourney · code I wrote while learning

Determine the profit or loss for each cosmetic item sold

2 items

README.md

Single File Programming Question

Problem Statement

Ramu, a dedicated businessman who operates a cosmetic store, is seeking assistance to analyze the financial performance of his business. He is looking for a program that can help him determine the profit or loss for each cosmetic item he sells. Help him with a program.

Input format

  • The first line of input consists of a floating-point number representing the cost.
  • The second line of input consists of a floating-point number representing the selling price.

Output format

  • If there is a profit, the output displays "Profit = " followed by the profit amount rounded to two decimal places.
  • If there is a loss, the output displays "Loss = " followed by the loss amount rounded to two decimal places.
  • If there is neither profit nor loss, the output displays "No profit or no loss".

Refer to the sample output for the formatting specifications.

Code constraints

  • (0 \leq \text{cost price}, \text{selling price} < 10^7)

Sample test cases

Input 1

85.74
100.45

Output 1

Profit = 14.71

Input 2

72.06
66.88

Output 2

Loss = 5.18

Input 3

99.99
99.99

Output 3

No profit or no loss