Previous Next
0 / 15
Module DEMO-33-63DEMO-OOP-33

Profit Margin Report

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read cost and selling prices, then print the profit and profit margin percentage.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. cost price
  2. selling price

Output Format

Print the exact report in this order:

  1. Profit
  2. Margin

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
10.0
15.0
Profit: 5.00
Margin: 50.00
Input: cost price = 10.0, selling price = 15.0.
Key calculation(s): profit = 15.0 - 10.0 | margin = (profit / 10.0) * 100.0 | "Profit: " + String.format("%.2f", profit) = "Profit: 5.00".
Output:
Profit: 5.00
Margin: 50.00
Sample #2
Public sample
40.0
50.0
Profit: 10.00
Margin: 25.00
Input: cost price = 40.0, selling price = 50.0.
Key calculation(s): profit = 50.0 - 40.0 | margin = (profit / 40.0) * 100.0 | "Profit: " + String.format("%.2f", profit) = "Profit: 10.00".
Output:
Profit: 10.00
Margin: 25.00

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings