Simple Profit Calculator
About this app
A fun and colorful calculator to compute profit through subtraction of two numbers. Get immediate results with up to 4 decimal places!
Simple Profit Calculator Calculator 1 (A - B) Calculate Result C: 0.0000 Take Profit: 0.0000 Calculator 2 (B - A) Calculate Result C: 0.0000 Take Profit: 0.0000
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Simple Profit Calculator</title>
<meta name="description" content="A fun and colorful calculator to compute profit through subtraction of two numbers. Get immediate results with up to 4 decimal places!">
<meta name="keywords" content="profit calculator, subtraction calculator, financial calculator, simple calculator, math calculator">
<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">
<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
const calculateProfit1 = (a, b) => {
const c = (a - b).toFixed(4);
const takeProfit = (a - c).toFixed(4);
return {c, takeProfit};
};
const calculateProfit2 = (a, b) => {
const c = (b - a).toFixed(4);
const takeProfit = (b - c).toFixed(4);
return {c, takeProfit};
};
$('#calculate-1').click(function() {
const a = parseFloat($('#inputA-1').val());
const b = parseFloat($('#inputB-1').val());
if (!isNaN(a) && !isNaN(b)) {
const {c, takeProfit} = calculateProfit1(a, b);
$('#resultC-1').text(c);
$('#resultTakeProfit-1').text(takeProfit);
} else {
alert('Please enter valid numbers for Calculator 1.');
}
});
$('#calculate-2').click(function() {
const a = parseFloat($('#inputA-2').val());
const b = parseFloat($('#inputB-2').val());
if (!isNaN(a) && !isNaN(b)) {
const {c, takeProfit} = calculateProfit2(a, b);
$('#resultC-2').text(c);
$('#resultTakeProfit-2').text(takeProfit);
} else {
alert('Please enter valid numbers for Calculator 2.');
}
});
});
} catch (error) {
throw error;
}
</script>
<style>
body {
background: linear-gradient(to right, #74ebd5, #ACB6E5);
font-family: 'Arial', sans-serif;
color: #333;
}
#main-container {
margin-top: 50px;
}
.calculator {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.btn {
background-color: #ff6633;
color: white;
}
.btn:hover {
background-color: #ff944d;
}
h3 {
color: #4a4a4a;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<div class="calculator">
<h3>Calculator 1 (A - B)</h3>
<input type="number" step="0.0001" id="inputA-1" placeholder="Enter value for A" class="form-control mb-2">
<input type="number" step="0.0001" id="inputB-1" placeholder="Enter value for B" class="form-control mb-2">
<button id="calculate-1" class="btn btn-primary">Calculate</button>
<h5>Result C: <span id="resultC-1">0.0000</span></h5>
<h5>Take Profit: <span id="resultTakeProfit-1">0.0000</span></h5>
</div>
<div class="calculator">
<h3>Calculator 2 (B - A)</h3>
<input type="number" step="0.0001" id="inputA-2" placeholder="Enter value for A" class="form-control mb-2">
<input type="number" step="0.0001" id="inputB-2" placeholder="Enter value for B" class="form-control mb-2">
<button id="calculate-2" class="btn btn-primary">Calculate</button>
<h5>Result C: <span id="resultC-2">0.0000</span></h5>
<h5>Take Profit: <span id="resultTakeProfit-2">0.0000</span></h5>
</div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!