let sum = 0
function add(val){
if(val.checked){
sum+= parseInt(val.value);
} else {
sum-= parseInt(val.value);
}
document.getElementById('result')=sum;
}
function add(val){
let sum = parseInt(document.getElementById('result'));
if(val.checked){
sum+= parseInt(val.value);
} else {
sum-= parseInt(val.value);
}
document.getElementById('result')=sum;
}