JSFiddle - React, Tailwind, and code Playground
by Qwerty_Wasd
HTML
<form id="counter">
<input type="radio" name="x" id="2x" value="2" checked>2x
<br><br>
<input type="radio" name="x" id="3x" value="3">3x
<br><br>
<input name="_1" type="number" placeholder="Операнд 1: "> <input name="_2" type="number" placeholder="Операнд 2: "><br><br>
<input type="checkbox" id="tov1" value="10">Прибавить 10
<br><br>
<input name="res" placeholder="Итого: " readonly>
</form>
JavaScript
document.getElementById(`counter`).addEventListener(`input`, e => {
e.currentTarget.lastElementChild.value =
(+e.currentTarget.children[e.currentTarget.children[0].checked ? 0 : 3].value *
(+e.currentTarget.children[6].value | 0)) +
(+e.currentTarget.children[7].value | 0) +
(e.currentTarget.children[10].checked ? +e.currentTarget.children[10].value : 0);
});