
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
<script>
function score(a) {
var a
if (a > 0 && a <= 50) {
var sum = 0
for (var n = 1; n <= a; n++) {
if (n <= 20) {
sum += n
}
else if (n <= 30) {
sum += 10
}
else if (n <= 40) {
sum += 20
}
else if (n < 50) {
sum += 30
}
else if (n == 50) {
sum += 100
}
}
} console.log(sum)
}
score(21)
</script>
</html>