Lokendra S. answered 04/03/23
Sr. Software Developer
<!DOCTYPE html>
<html>
<head>
<title>Equation Solver</title>
</head>
<body>
<h1>Equation Solver</h1>
<p>Solving equation x - 2y + 3z = 0 within the domain x ∈ [1,5], y ∈ [6,10], z ∈ [3,7]</p>
<table border="1">
<thead>
<tr>
<th>x</th>
<th>y</th>
<th>z</th>
</tr>
</thead>
<tbody id="solution">
</tbody>
</table>
<script>
function solveEquation() {
var solution = document.getElementById("solution");
solution.innerHTML = "";
for (var x = 1; x <= 5; x++) {
for (var y = 6; y <= 10; y++) {
for (var z = 3; z <= 7; z++) {
if ((x - 2*y + 3*z) == 0) {
var row = document.createElement("tr");
var xCell = document.createElement("td");
xCell.textContent = x;
row.appendChild(xCell);
var yCell = document.createElement("td");
yCell.textContent = y;
row.appendChild(yCell);
var zCell = document.createElement("td");
zCell.textContent = z;
row.appendChild(zCell);
solution.appendChild(row);
}
}
}
}
}
solveEquation();
</script>
</body>
</html>